imsciences 0.6.2.9__tar.gz → 0.6.3.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imsciences
3
- Version: 0.6.2.9
3
+ Version: 0.6.3.1
4
4
  Summary: IMS Data Processing Package
5
5
  Author: IMS
6
6
  Author-email: cam@im-sciences.com
@@ -237,8 +237,12 @@ class dataprocessing:
237
237
  print(" - Usage: plot_chart(df, date_col, value_cols, chart_type='line', title='Chart', x_title='Date', y_title='Values', **kwargs)")
238
238
  print(" - Example: plot_chart(df, 'obs', df.cols, chart_type='line', title='Spend Over Time', x_title='Date', y_title='Spend')")
239
239
 
240
+ print("\n43. plot_two_with_common_cols")
241
+ print(" - Description: Plots the number of charts in two dataframes for which there are two common column names")
242
+ print(" - Usage: plot_two_with_common_cols(df1, df2, date_column, same_axis=True)")
243
+ print(" - Example: plot_two_with_common_cols(df_1, df_2,date_column='obs')")
240
244
 
241
-
245
+
242
246
  def get_wd_levels(self, levels):
243
247
  """
244
248
  Gets the current wd of whoever is working on it and gives the options to move the number of levels up.
@@ -1553,7 +1557,6 @@ class dataprocessing:
1553
1557
 
1554
1558
  return diff_df, total_diff_df
1555
1559
 
1556
- # Convert week commencing col (should be most likely monday to sunday or vice versa)
1557
1560
  def week_commencing_2_week_commencing_conversion(self,df,date_col,week_commencing='sun'):
1558
1561
  """
1559
1562
  Convert week commencing column in a DataFrame to the start of another day specified.
@@ -1709,6 +1712,34 @@ class dataprocessing:
1709
1712
 
1710
1713
  return fig
1711
1714
 
1715
+ def plot_two_with_common_cols(self, df1, df2, date_column, same_axis=True):
1716
+ """
1717
+ Plot multiple series from two DataFrames with common columns using a specified date column for the X-axis.
1718
+
1719
+ Args:
1720
+ df1 (pandas.DataFrame): The first DataFrame containing data to plot.
1721
+ df2 (pandas.DataFrame): The second DataFrame containing data to plot.
1722
+ date_column (str): The name of the date column in the DataFrames.
1723
+ same_axis (bool, optional): Whether to plot the series on the same y-axis. Defaults to True.
1724
+
1725
+ Returns:
1726
+ list: A list of Plotly figures generated from the common columns.
1727
+ """
1728
+ # Find common columns between df1 and df2, excluding the date column
1729
+ common_columns = list(set(df1.columns).intersection(set(df2.columns)) - {date_column})
1730
+
1731
+ # Generate col_pairs list for plot_two function
1732
+ col_pairs = [(col, col) for col in common_columns]
1733
+
1734
+ # Loop through the common columns and plot each pair
1735
+ figs = []
1736
+ for col1, col2 in col_pairs:
1737
+ # Call the existing plot_two function
1738
+ fig = self.plot_two(df1, col1, df2, col2, date_column, same_axis=same_axis)
1739
+ figs.append(fig)
1740
+
1741
+ return figs
1742
+
1712
1743
  ########################################################################################################################################
1713
1744
  ########################################################################################################################################
1714
1745
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imsciences
3
- Version: 0.6.2.9
3
+ Version: 0.6.3.1
4
4
  Summary: IMS Data Processing Package
5
5
  Author: IMS
6
6
  Author-email: cam@im-sciences.com
@@ -8,7 +8,7 @@ def read_md(file_name):
8
8
  return f.read()
9
9
  return ''
10
10
 
11
- VERSION = '0.6.2.9'
11
+ VERSION = '0.6.3.1'
12
12
  DESCRIPTION = 'IMS Data Processing Package'
13
13
  LONG_DESCRIPTION = read_md('README.md') # Reading from README.md
14
14
 
File without changes
File without changes