imsciences 0.6.2.4__py3-none-any.whl → 0.6.2.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,8 +109,8 @@ class dataprocessing:
109
109
 
110
110
  print("\n17. pivot_table")
111
111
  print(" - Description: Dynamically pivots a DataFrame based on specified columns.")
112
- print(" - Usage: pivot_table(df, index_col, columns, values_col, filters_dict=None, fill_value=0,aggfunc='sum',margins=False,margins_name='Total',datetime_trans_needed=True,reverse_header_order = 'False')")
113
- print(" - Example: pivot_table(df, 'OBS', 'Channel Short Names', 'Value',filters_dict={'Master Include':' == 1','OBS':' >= datetime(2019,9,9)','Metric Short Names':' == 'spd''}, fill_value=0,aggfunc='sum',margins=False,margins_name='Total',datetime_trans_needed=True,reverse_header_order = 'True')")
112
+ print(" - Usage: pivot_table(df, index_col, columns, values_col, filters_dict=None, fill_value=0,aggfunc='sum',margins=False,margins_name='Total',datetime_trans_needed=True,reverse_header_order = 'False',fill_missing_weekly_dates=False,week_commencing='W-MON')")
113
+ print(" - Example: pivot_table(df, 'OBS', 'Channel Short Names', 'Value',filters_dict={'Master Include':' == 1','OBS':' >= datetime(2019,9,9)','Metric Short Names':' == 'spd''}, fill_value=0,aggfunc='sum',margins=False,margins_name='Total',datetime_trans_needed=True,reverse_header_order = 'True',fill_missing_weekly_dates=True,week_commencing='W-MON')")
114
114
 
115
115
  print("\n18. apply_lookup_table_for_columns")
116
116
  print(" - Description: Equivalent of xlookup in excel. Allows you to map a dictionary of substrings within a column. If multiple columns are need for the LUT then a | seperator is needed.")
@@ -664,7 +664,7 @@ class dataprocessing:
664
664
 
665
665
  return combined_df
666
666
 
667
- def pivot_table(self, df, index_col, columns, values_col, filters_dict=None, fill_value=0, aggfunc='sum', margins=False, margins_name="Total", datetime_trans_needed=True, reverse_header_order=False):
667
+ def pivot_table(self, df, index_col, columns, values_col, filters_dict=None, fill_value=0, aggfunc='sum', margins=False, margins_name="Total", datetime_trans_needed=True, reverse_header_order=False,fill_missing_weekly_dates=False,week_commencing='W-MON'):
668
668
  """
669
669
  Provides the ability to create pivot tables, filtering the data to get to data you want and then pivoting on certain columns
670
670
 
@@ -680,6 +680,8 @@ class dataprocessing:
680
680
  margins_name (str, optional): The name of the Totals columns. Defaults to "Total".
681
681
  datetime_trans_needed (bool, optional): Whether the index column needs to be transformed into datetime format. Defaults to False.
682
682
  reverse_header_order (bool, optional): Reverses the order of the column headers. Defaults to False.
683
+ fill_missing_weekly_dates (bool, optional): Fills in any weekly missing dates. Defaults to False.
684
+ week_commencing (str,optional): Fills in missing weeks if option is specified. Defaults to 'W-MON'.
683
685
 
684
686
  Returns:
685
687
  pandas.DataFrame: The pivot table specified
@@ -730,6 +732,10 @@ class dataprocessing:
730
732
  # Fill in any NaNs
731
733
  pivoted_df = pivoted_df.fillna(fill_value)
732
734
 
735
+ # If there is a need to fill in missing weeks
736
+ if fill_missing_weekly_dates == True:
737
+ pivoted_df = self.fill_weekly_date_range(pivoted_df, index_col, freq=week_commencing)
738
+
733
739
  return pivoted_df
734
740
 
735
741
  def apply_lookup_table_for_columns(self, df, col_names, to_find_dict, if_not_in_dict="Other", new_column_name="Mapping"):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imsciences
3
- Version: 0.6.2.4
3
+ Version: 0.6.2.6
4
4
  Summary: IMS Data Processing Package
5
5
  Author: IMS
6
6
  Author-email: cam@im-sciences.com
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.1
2
+ Name: imsciences
3
+ Version: 0.6.1.1
4
+ Summary: IMS Data Processing Package
5
+ Author: IMS
6
+ Author-email: cam@im-sciences.com
7
+ Keywords: python,data processing
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: Unix
12
+ Classifier: Operating System :: MacOS :: MacOS X
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: pandas
16
+
17
+ # IMS Package Documentation
18
+
19
+ The IMS package is a python library for processing incoming data into a format that can be used for projects. IMS processing offers a variety of functions to manipulate and analyze data efficiently. Here are the functionalities provided by the package:
20
+
21
+ ## Data Processing
22
+
23
+ ## Data Pulling
24
+
@@ -2,13 +2,15 @@ dataprocessing/__init__.py,sha256=quSwsLs6IuLoA5Rzi0ZD40xZaQudwDteF7_ai9JfTPk,32
2
2
  dataprocessing/data-processing-functions.py,sha256=vE1vsZ8xOSbR9Bwlp9SWXwEHXQ0nFydwGkvzHXf2f1Y,41
3
3
  dataprocessing/datafunctions.py,sha256=vE1vsZ8xOSbR9Bwlp9SWXwEHXQ0nFydwGkvzHXf2f1Y,41
4
4
  imsciences/__init__.py,sha256=GIPbLmWc06sVcOySWwNvMNUr6XGOHqPLryFIWgtpHh8,78
5
- imsciences/datafunctions.py,sha256=WOdezS0IW_n91eWr9SL_czLjCCkl5-951n58sjCG51Q,143447
5
+ imsciences/datafunctions-IMS-24Ltp-3.py,sha256=3Snv-0iE_03StmyjtT-riOU9f4v8TaJWLoyZLJp6l8Y,141406
6
+ imsciences/datafunctions.py,sha256=m5fXoFDJ9bkYMA3tIxsTOr2NmxlWSuoqqi5IvNO2RC8,144041
6
7
  imsciences/datapull.py,sha256=TPY0LDgOkcKTBk8OekbD0Grg5x0SomAK2dZ7MuT6X1E,19000
7
8
  imsciencesdataprocessing/__init__.py,sha256=quSwsLs6IuLoA5Rzi0ZD40xZaQudwDteF7_ai9JfTPk,32
8
9
  imsciencesdataprocessing/datafunctions.py,sha256=vE1vsZ8xOSbR9Bwlp9SWXwEHXQ0nFydwGkvzHXf2f1Y,41
9
10
  imsdataprocessing/__init__.py,sha256=quSwsLs6IuLoA5Rzi0ZD40xZaQudwDteF7_ai9JfTPk,32
10
11
  imsdataprocessing/datafunctions.py,sha256=vE1vsZ8xOSbR9Bwlp9SWXwEHXQ0nFydwGkvzHXf2f1Y,41
11
- imsciences-0.6.2.4.dist-info/METADATA,sha256=SCrc8u73aXgoIIMlXIIbEnKrUh7SXcBQOA4FaElRy04,854
12
- imsciences-0.6.2.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- imsciences-0.6.2.4.dist-info/top_level.txt,sha256=hsENS-AlDVRh8tQJ6-426iUQlla9bPcGc0-UlFF0_iU,11
14
- imsciences-0.6.2.4.dist-info/RECORD,,
12
+ imsciences-0.6.2.6.dist-info/METADATA,sha256=SmZRpsI3cGnW8fQgXurxtsmJgg1GhlotKPOFZ1iPs6o,854
13
+ imsciences-0.6.2.6.dist-info/PKG-INFO-IMS-24Ltp-3,sha256=yqZbigwHjnYoqyI81PGz_AeofRFfOrwH_Vyawyef-mg,854
14
+ imsciences-0.6.2.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
15
+ imsciences-0.6.2.6.dist-info/top_level.txt,sha256=hsENS-AlDVRh8tQJ6-426iUQlla9bPcGc0-UlFF0_iU,11
16
+ imsciences-0.6.2.6.dist-info/RECORD,,