imsciences 0.6.0.4__tar.gz → 0.6.0.5__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.0.4
3
+ Version: 0.6.0.5
4
4
  Summary: IMS Data Processing Package
5
5
  Author: IMS
6
6
  Author-email: cam@im-sciences.com
@@ -898,7 +898,7 @@ class dataprocessing:
898
898
  start_year = int(starting_FY[2:])
899
899
 
900
900
  def calculate_FY_vectorized(date_series):
901
- years_since_start = ((date_series - start_date).dt.days / 365.25).astype(int)
901
+ years_since_start = ((date_series - start_date).dt.days / 364).astype(int)
902
902
  fy = 'FY' + (start_year + years_since_start).astype(str)
903
903
  if short_format == "Yes":
904
904
  fy = 'FY' + fy.str[-2:]
@@ -907,8 +907,14 @@ class dataprocessing:
907
907
  df['FY'] = calculate_FY_vectorized(df[index_col])
908
908
 
909
909
  if half_years == "Yes" or combined_FY_and_H == "Yes":
910
- end_of_h1 = start_date + pd.DateOffset(months=6) - pd.DateOffset(days=1)
911
- df['Half Years'] = np.where(df[index_col] <= end_of_h1, 'H1', 'H2')
910
+ def calculate_half_year_vectorized(date_series):
911
+ fy_years_since_start = ((date_series - start_date).dt.days / 364).astype(int)
912
+ fy_start_dates = start_date + fy_years_since_start * pd.DateOffset(years=1)
913
+ fy_end_of_h1 = fy_start_dates + pd.DateOffset(weeks=26) - pd.DateOffset(weeks=1)
914
+ half_year = np.where(date_series <= fy_end_of_h1, 'H1', 'H2')
915
+ return half_year
916
+
917
+ df['Half Years'] = calculate_half_year_vectorized(df[index_col])
912
918
 
913
919
  if combined_FY_and_H == "Yes":
914
920
  df['Financial Half Years'] = df['FY'] + ' ' + df['Half Years']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imsciences
3
- Version: 0.6.0.4
3
+ Version: 0.6.0.5
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.0.4'
11
+ VERSION = '0.6.0.5'
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