ecopipeline 0.11.0__tar.gz → 0.11.3__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.
Files changed (26) hide show
  1. {ecopipeline-0.11.0/src/ecopipeline.egg-info → ecopipeline-0.11.3}/PKG-INFO +1 -1
  2. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/setup.cfg +1 -1
  3. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/event_tracking/event_tracking.py +136 -18
  4. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/transform/__init__.py +3 -2
  5. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/transform/transform.py +75 -1
  6. {ecopipeline-0.11.0 → ecopipeline-0.11.3/src/ecopipeline.egg-info}/PKG-INFO +1 -1
  7. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/LICENSE +0 -0
  8. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/README.md +0 -0
  9. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/pyproject.toml +0 -0
  10. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/setup.py +0 -0
  11. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/__init__.py +0 -0
  12. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/event_tracking/__init__.py +0 -0
  13. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/extract/__init__.py +0 -0
  14. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/extract/extract.py +0 -0
  15. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/load/__init__.py +0 -0
  16. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/load/load.py +0 -0
  17. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/transform/bayview.py +0 -0
  18. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/transform/lbnl.py +0 -0
  19. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/utils/ConfigManager.py +0 -0
  20. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/utils/NOAADataDownloader.py +0 -0
  21. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/utils/__init__.py +0 -0
  22. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline/utils/unit_convert.py +0 -0
  23. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
  24. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
  25. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline.egg-info/requires.txt +0 -0
  26. {ecopipeline-0.11.0 → ecopipeline-0.11.3}/src/ecopipeline.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecopipeline
3
- Version: 0.11.0
3
+ Version: 0.11.3
4
4
  Summary: Contains functions for use in Ecotope Datapipelines
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ecopipeline
3
- version = 0.11.0
3
+ version = 0.11.3
4
4
  authors = ["Carlos Bello, <bellocarlos@seattleu.edu>, Emil Fahrig <fahrigemil@seattleu.edu>, Casey Mang <cmang@seattleu.edu>, Julian Harris <harrisjulian@seattleu.edu>, Roger Tram <rtram@seattleu.edu>, Nolan Price <nolan@ecotope.com>"]
5
5
  description = Contains functions for use in Ecotope Datapipelines
6
6
  long_description = file: README.md
@@ -4,15 +4,17 @@ import datetime as dt
4
4
  from ecopipeline import ConfigManager
5
5
  import re
6
6
  import mysql.connector.errors as mysqlerrors
7
+ from datetime import timedelta
7
8
 
8
9
  def central_alarm_df_creator(df: pd.DataFrame, daily_data : pd.DataFrame, config : ConfigManager, system: str = "",
9
10
  default_cop_high_bound : float = 4.5, default_cop_low_bound : float = 0,
10
- default_boundary_fault_time : int = 15, site_name : str = None) -> pd.DataFrame:
11
+ default_boundary_fault_time : int = 15, site_name : str = None, day_table_name_header : str = "day",
12
+ power_ratio_period_days : int = 7) -> pd.DataFrame:
11
13
  day_list = daily_data.index.to_list()
12
14
  print('Checking for alarms...')
13
15
  alarm_df = _convert_silent_alarm_dict_to_df({})
14
16
  boundary_alarm_df = flag_boundary_alarms(df, config, full_days=day_list, system=system, default_fault_time= default_boundary_fault_time)
15
- pwr_alarm_df = power_ratio_alarm(daily_data, config, system=system)
17
+ pwr_alarm_df = power_ratio_alarm(daily_data, config, day_table_name = config.get_table_name(day_table_name_header), system=system, ratio_period_days=power_ratio_period_days)
16
18
  abnormal_COP_df = flag_abnormal_COP(daily_data, config, system = system, default_high_bound=default_cop_high_bound, default_low_bound=default_cop_low_bound)
17
19
 
18
20
  if len(boundary_alarm_df) > 0:
@@ -251,7 +253,31 @@ def _check_and_add_alarm(df : pd.DataFrame, mask : pd.Series, alarms_dict, day,
251
253
  else:
252
254
  alarms_dict[day] = [[var_name, alarm_string]]
253
255
 
254
- def power_ratio_alarm(daily_df: pd.DataFrame, config : ConfigManager, system: str = "", verbose : bool = False) -> pd.DataFrame:
256
+ def power_ratio_alarm(daily_df: pd.DataFrame, config : ConfigManager, day_table_name : str, system: str = "", verbose : bool = False, ratio_period_days : int = 7) -> pd.DataFrame:
257
+ """
258
+ Function will take a pandas dataframe of daily data and location of alarm information in a csv,
259
+ and create an dataframe with applicable alarm events
260
+
261
+ Parameters
262
+ ----------
263
+ daily_df: pd.DataFrame
264
+ post-transformed dataframe for daily data. It should be noted that this function expects consecutive, in order days. If days
265
+ are out of order or have gaps, the function may return erroneous alarms.
266
+ config : ecopipeline.ConfigManager
267
+ The ConfigManager object that holds configuration data for the pipeline. Among other things, this object will point to a file
268
+ called Varriable_Names.csv in the input folder of the pipeline (e.g. "full/path/to/pipeline/input/Variable_Names.csv").
269
+ The file must have at least two columns which must be titled "variable_name", "alarm_codes" which should contain the
270
+ name of each variable in the dataframe that requires the alarming and the ratio alarm code in the form "PR_{Power Ratio Name}:{low percentage}-{high percentage}
271
+ system: str
272
+ string of system name if processing a particular system in a Variable_Names.csv file with multiple systems. Leave as an empty string if not aplicable.
273
+ verbose : bool
274
+ add print statements in power ratio
275
+
276
+ Returns
277
+ -------
278
+ pd.DataFrame:
279
+ Pandas dataframe with alarm events, empty if no alarms triggered
280
+ """
255
281
  daily_df_copy = daily_df.copy()
256
282
  variable_names_path = config.get_var_names_path()
257
283
  try:
@@ -274,8 +300,15 @@ def power_ratio_alarm(daily_df: pd.DataFrame, config : ConfigManager, system: st
274
300
  ratios_df = ratios_df.loc[:, ["variable_name", "alarm_codes", "pretty_name"]]
275
301
  ratios_df = ratios_df[ratios_df['alarm_codes'].str.contains('PR', na=False)]
276
302
  ratios_df.dropna(axis=0, thresh=2, inplace=True)
277
- ratios_df.set_index(['variable_name'], inplace=True)
303
+ if ratio_period_days > 1:
304
+ if verbose:
305
+ print(f"adding last {ratio_period_days} to daily_df")
306
+ daily_df_copy = _append_previous_days_to_df(daily_df_copy, config, ratio_period_days, day_table_name)
307
+ elif ratio_period_days < 1:
308
+ print("power ratio alarm period, ratio_period_days, must be more than 1")
309
+ return pd.DataFrame()
278
310
 
311
+ ratios_df.set_index(['variable_name'], inplace=True)
279
312
  ratio_dict = {}
280
313
  for ratios_var, ratios in ratios_df.iterrows():
281
314
  if not ratios_var in daily_df_copy.columns:
@@ -297,26 +330,111 @@ def power_ratio_alarm(daily_df: pd.DataFrame, config : ConfigManager, system: st
297
330
  ratio_dict[pr_id] = [[ratios_var],[float(low_high[0])],[float(low_high[1])],[ratios['pretty_name']]]
298
331
  if verbose:
299
332
  print("ratio_dict keys:", ratio_dict.keys())
333
+ # Create blocks of ratio_period_days
334
+ blocks_df = _create_period_blocks(daily_df_copy, ratio_period_days, verbose)
335
+
336
+ if blocks_df.empty:
337
+ print("No complete blocks available for analysis")
338
+ return pd.DataFrame()
339
+
300
340
  alarms = {}
301
341
  for key, value_list in ratio_dict.items():
302
- daily_df_copy[key] = daily_df_copy[value_list[0]].sum(axis=1)
342
+ # Calculate total for each block
343
+ blocks_df[key] = blocks_df[value_list[0]].sum(axis=1)
303
344
  for i in range(len(value_list[0])):
304
345
  column_name = value_list[0][i]
305
- daily_df_copy[f'{column_name}_{key}'] = (daily_df_copy[column_name]/daily_df_copy[key]) * 100
346
+ # Calculate ratio for each block
347
+ blocks_df[f'{column_name}_{key}'] = (blocks_df[column_name]/blocks_df[key]) * 100
306
348
  if verbose:
307
- print(f"Ratios for {column_name}_{key}",daily_df_copy[f'{column_name}_{key}'])
308
- _check_and_add_ratio_alarm(daily_df_copy, key, column_name, value_list[3][i], alarms, value_list[2][i], value_list[1][i])
309
- return _convert_silent_alarm_dict_to_df(alarms)
310
-
311
- def _check_and_add_ratio_alarm(daily_df: pd.DataFrame, alarm_key : str, column_name : str, pretty_name : str, alarms_dict : dict, high_bound : float, low_bound : float):
312
- alarm_daily_df = daily_df.loc[(daily_df[f"{column_name}_{alarm_key}"] < low_bound) | (daily_df[f"{column_name}_{alarm_key}"] > high_bound)]
313
- if not alarm_daily_df.empty:
314
- for day, values in alarm_daily_df.iterrows():
315
- alarm_str = f"Power ratio alarm: {pretty_name} accounted for {round(values[f'{column_name}_{alarm_key}'], 2)}% of {alarm_key} energy use. {round(low_bound, 2)}-{round(high_bound, 2)}% of {alarm_key} energy use expected."
316
- if day in alarms_dict:
317
- alarms_dict[day].append([column_name, alarm_str])
349
+ print(f"Block ratios for {column_name}_{key}:", blocks_df[f'{column_name}_{key}'])
350
+ _check_and_add_ratio_alarm_blocks(blocks_df, key, column_name, value_list[3][i], alarms, value_list[2][i], value_list[1][i], ratio_period_days)
351
+ return _convert_silent_alarm_dict_to_df(alarms)
352
+ # alarms = {}
353
+ # for key, value_list in ratio_dict.items():
354
+ # daily_df_copy[key] = daily_df_copy[value_list[0]].sum(axis=1)
355
+ # for i in range(len(value_list[0])):
356
+ # column_name = value_list[0][i]
357
+ # daily_df_copy[f'{column_name}_{key}'] = (daily_df_copy[column_name]/daily_df_copy[key]) * 100
358
+ # if verbose:
359
+ # print(f"Ratios for {column_name}_{key}",daily_df_copy[f'{column_name}_{key}'])
360
+ # _check_and_add_ratio_alarm(daily_df_copy, key, column_name, value_list[3][i], alarms, value_list[2][i], value_list[1][i])
361
+ # return _convert_silent_alarm_dict_to_df(alarms)
362
+
363
+ # def _check_and_add_ratio_alarm(daily_df: pd.DataFrame, alarm_key : str, column_name : str, pretty_name : str, alarms_dict : dict, high_bound : float, low_bound : float):
364
+ # alarm_daily_df = daily_df.loc[(daily_df[f"{column_name}_{alarm_key}"] < low_bound) | (daily_df[f"{column_name}_{alarm_key}"] > high_bound)]
365
+ # if not alarm_daily_df.empty:
366
+ # for day, values in alarm_daily_df.iterrows():
367
+ # alarm_str = f"Power ratio alarm: {pretty_name} accounted for {round(values[f'{column_name}_{alarm_key}'], 2)}% of {alarm_key} energy use. {round(low_bound, 2)}-{round(high_bound, 2)}% of {alarm_key} energy use expected."
368
+ # if day in alarms_dict:
369
+ # alarms_dict[day].append([column_name, alarm_str])
370
+ # else:
371
+ # alarms_dict[day] = [[column_name, alarm_str]]
372
+ def _check_and_add_ratio_alarm_blocks(blocks_df: pd.DataFrame, alarm_key: str, column_name: str, pretty_name: str, alarms_dict: dict, high_bound: float, low_bound: float, ratio_period_days: int):
373
+ """
374
+ Check for alarms in block-based ratios and add to alarms dictionary.
375
+ """
376
+ alarm_blocks_df = blocks_df.loc[(blocks_df[f"{column_name}_{alarm_key}"] < low_bound) | (blocks_df[f"{column_name}_{alarm_key}"] > high_bound)]
377
+ if not alarm_blocks_df.empty:
378
+ for block_end_date, values in alarm_blocks_df.iterrows():
379
+ alarm_str = f"Power ratio alarm ({ratio_period_days}-day block ending {block_end_date.strftime('%Y-%m-%d')}): {pretty_name} accounted for {round(values[f'{column_name}_{alarm_key}'], 2)}% of {alarm_key} energy use. {round(low_bound, 2)}-{round(high_bound, 2)}% of {alarm_key} energy use expected."
380
+ if block_end_date in alarms_dict:
381
+ alarms_dict[block_end_date].append([column_name, alarm_str])
318
382
  else:
319
- alarms_dict[day] = [[column_name, alarm_str]]
383
+ alarms_dict[block_end_date] = [[column_name, alarm_str]]
384
+
385
+ def _create_period_blocks(daily_df: pd.DataFrame, ratio_period_days: int, verbose: bool = False) -> pd.DataFrame:
386
+ """
387
+ Create blocks of ratio_period_days by summing values within each block.
388
+ Each block will be represented by its end date.
389
+ """
390
+ if len(daily_df) < ratio_period_days:
391
+ if verbose:
392
+ print(f"Not enough data for {ratio_period_days}-day blocks. Need at least {ratio_period_days} days, have {len(daily_df)}")
393
+ return pd.DataFrame()
394
+
395
+ blocks = []
396
+ block_dates = []
397
+
398
+ # Create blocks by summing consecutive groups of ratio_period_days
399
+ for i in range(ratio_period_days - 1, len(daily_df)):
400
+ start_idx = i - ratio_period_days + 1
401
+ end_idx = i + 1
402
+
403
+ block_data = daily_df.iloc[start_idx:end_idx].sum()
404
+ blocks.append(block_data)
405
+ # Use the end date of the block as the identifier
406
+ block_dates.append(daily_df.index[i])
407
+
408
+ if not blocks:
409
+ return pd.DataFrame()
410
+
411
+ blocks_df = pd.DataFrame(blocks, index=block_dates)
412
+
413
+ if verbose:
414
+ print(f"Created {len(blocks_df)} blocks of {ratio_period_days} days each")
415
+ print(f"Block date range: {blocks_df.index.min()} to {blocks_df.index.max()}")
416
+
417
+ return blocks_df
418
+
419
+ def _append_previous_days_to_df(daily_df: pd.DataFrame, config : ConfigManager, ratio_period_days : int, day_table_name : str, primary_key : str = "time_pt") -> pd.DataFrame:
420
+ db_connection, cursor = config.connect_db()
421
+ period_start = daily_df.index.min() - timedelta(ratio_period_days)
422
+ try:
423
+ # find existing times in database for upsert statement
424
+ cursor.execute(
425
+ f"SELECT * FROM {day_table_name} WHERE {primary_key} < '{daily_df.index.min()}' AND {primary_key} >= '{period_start}'")
426
+ result = cursor.fetchall()
427
+ column_names = [desc[0] for desc in cursor.description]
428
+ old_days_df = pd.DataFrame(result, columns=column_names)
429
+ old_days_df = old_days_df.set_index(primary_key)
430
+ daily_df = pd.concat([daily_df, old_days_df])
431
+ daily_df = daily_df.sort_index(ascending=True)
432
+ except mysqlerrors.Error:
433
+ print(f"Table {day_table_name} has no data.")
434
+
435
+ db_connection.close()
436
+ cursor.close()
437
+ return daily_df
320
438
 
321
439
  # def flag_dhw_outage(df: pd.DataFrame, daily_df : pd.DataFrame, dhw_outlet_column : str, supply_temp : int = 110, consecutive_minutes : int = 15) -> pd.DataFrame:
322
440
  # """
@@ -1,7 +1,8 @@
1
1
  from .transform import rename_sensors, avg_duplicate_times, remove_outliers, ffill_missing, nullify_erroneous, sensor_adjustment, round_time, \
2
2
  aggregate_df, join_to_hourly, concat_last_row, join_to_daily, cop_method_1, cop_method_2, create_summary_tables, remove_partial_days, \
3
3
  convert_c_to_f,convert_l_to_g, convert_on_off_col_to_bool, flag_dhw_outage,generate_event_log_df,convert_time_zone, shift_accumulative_columns, \
4
- heat_output_calc, add_relative_humidity, apply_equipment_cop_derate, create_data_statistics_df, delete_erroneous_from_time_pt,column_name_change
4
+ heat_output_calc, add_relative_humidity, apply_equipment_cop_derate, create_data_statistics_df, delete_erroneous_from_time_pt,column_name_change, \
5
+ process_ls_signal
5
6
  from .lbnl import nclarity_filter_new, site_specific, condensate_calculations, gas_valve_diff, gather_outdoor_conditions, aqsuite_prep_time, \
6
7
  nclarity_csv_to_df, _add_date, add_local_time, aqsuite_filter_new, get_refrig_charge, elev_correction, change_ID_to_HVAC, get_hvac_state, \
7
8
  get_cop_values, get_cfm_values, replace_humidity, create_fan_curves, lbnl_temperature_conversions, lbnl_pressure_conversions, \
@@ -13,4 +14,4 @@ __all__ = ["rename_sensors", "avg_duplicate_times", "remove_outliers", "ffill_mi
13
14
  "create_fan_curves", "lbnl_temperature_conversions", "lbnl_pressure_conversions", "lbnl_sat_calculations", "get_site_cfm_info", "get_site_info", "merge_indexlike_rows", "calculate_cop_values", "aggregate_values",
14
15
  "get_energy_by_min", "verify_power_energy", "get_temp_zones120", "get_storage_gals120","convert_c_to_f","convert_l_to_g", "convert_on_off_col_to_bool", "flag_dhw_outage","generate_event_log_df","convert_time_zone",
15
16
  "shift_accumulative_columns","heat_output_calc", "add_relative_humidity","apply_equipment_cop_derate","create_data_statistics_df",
16
- "delete_erroneous_from_time_pt","column_name_change"]
17
+ "delete_erroneous_from_time_pt","column_name_change","process_ls_signal"]
@@ -245,7 +245,6 @@ def _ffill(col, ffill_df, previous_fill: pd.DataFrame = None): # Helper functio
245
245
  elif (cp == 0): # ffill only up to length
246
246
  col.fillna(method='ffill', inplace=True, limit=length)
247
247
 
248
-
249
248
  def ffill_missing(original_df: pd.DataFrame, config : ConfigManager, previous_fill: pd.DataFrame = None) -> pd.DataFrame:
250
249
  """
251
250
  Function will take a pandas dataframe and forward fill select variables with no entry.
@@ -306,6 +305,81 @@ def ffill_missing(original_df: pd.DataFrame, config : ConfigManager, previous_fi
306
305
  df.apply(_ffill, args=(ffill_df,previous_fill))
307
306
  return df
308
307
 
308
+ def process_ls_signal(df: pd.DataFrame, hourly_df: pd.DataFrame, daily_df: pd.DataFrame, load_dict: dict = {1: "normal", 2: "loadUp", 3 : "shed"}, ls_column: str = 'ls',
309
+ drop_ls_from_df : bool = True):
310
+ """
311
+ Function takes aggregated dfs and adds loadshift signals to hourly df and loadshift days to daily_df
312
+
313
+ Parameters
314
+ ----------
315
+ df: pd.DataFrame
316
+ Timestamp indexed Pandas dataframe of minute by minute values
317
+ hourly_df: pd.DataFrame
318
+ Timestamp indexed Pandas dataframe of hourly average values
319
+ daily_df: pd.DataFrame
320
+ Timestamp indexed Pandas dataframe of daily average values
321
+ load_dict: dict
322
+ dictionary of what loadshift signal is indicated by a value of the ls_column column in df
323
+ ls_column: str
324
+ the name of the loadshift column in df
325
+ drop_ls_from_df: bool
326
+ Set to true to drop ls_column from df after processing
327
+
328
+ Returns
329
+ -------
330
+ df: pd.DataFrame
331
+ Timestamp indexed Pandas dataframe of minute by minute values with ls_column removed if drop_ls_from_df = True
332
+ hourly_df: pd.DataFrame
333
+ Timestamp indexed Pandas dataframe of hourly average values with added column 'system_state' which contains the
334
+ loadshift command value from load_dict from the average (rounded to the nearest integer) key for all indexes in
335
+ df within that load_dict key. If the integer is not a key in load_dict, the loadshift command value will be null
336
+ daily_df: pd.DataFrame
337
+ Timestamp indexed Pandas dataframe of daily average values with added boolean column 'load_shift_day' which holds
338
+ the value True on days which contains hours in hourly_df in which there are loadshift commands other than normal
339
+ and Fals on days where the only command in normal unknown
340
+ """
341
+ # Make copies to avoid modifying original dataframes
342
+ df_copy = df.copy()
343
+
344
+ if ls_column in df_copy.columns:
345
+ df_copy = df_copy[df_copy[ls_column].notna() & np.isfinite(df_copy[ls_column])]
346
+
347
+ # Process hourly data - aggregate ls_column values by hour and map to system_state
348
+ if ls_column in df.columns:
349
+ # Group by hour and calculate mean of ls_column, then round to nearest integer
350
+ hourly_ls = df_copy[ls_column].resample('H').mean().round().astype(int)
351
+
352
+ # Map the rounded integer values to load_dict, using None for unmapped values
353
+ hourly_df['system_state'] = hourly_ls.map(load_dict)
354
+
355
+ # For hours not present in the minute data, system_state will be NaN
356
+ hourly_df['system_state'] = hourly_df['system_state'].where(
357
+ hourly_df.index.isin(hourly_ls.index)
358
+ )
359
+ else:
360
+ # If ls_column doesn't exist, set all system_state to None
361
+ hourly_df['system_state'] = None
362
+
363
+ # Process daily data - determine if any non-normal loadshift commands occurred
364
+ if 'system_state' in hourly_df.columns:
365
+ # Group by date and check if any non-"normal" and non-null system_state exists
366
+ daily_ls = hourly_df.groupby(hourly_df.index.date)['system_state'].apply(
367
+ lambda x: any((state != "normal") and (state is not None) for state in x.dropna())
368
+ )
369
+
370
+ # Map the daily boolean results to the daily_df index
371
+ daily_df['load_shift_day'] = daily_df.index.date
372
+ daily_df['load_shift_day'] = daily_df['load_shift_day'].map(daily_ls).fillna(False)
373
+ else:
374
+ # If no system_state column, set all days to False
375
+ daily_df['load_shift_day'] = False
376
+
377
+ # Drop ls_column from df if requested
378
+ if drop_ls_from_df and ls_column in df.columns:
379
+ df = df.drop(columns=[ls_column])
380
+
381
+ return df, hourly_df, daily_df
382
+
309
383
  def delete_erroneous_from_time_pt(df: pd.DataFrame, time_point : pd.Timestamp, column_names : list, new_value = None) -> pd.DataFrame:
310
384
  """
311
385
  Function will take a pandas dataframe and delete specified erroneous values at a specified time point.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecopipeline
3
- Version: 0.11.0
3
+ Version: 0.11.3
4
4
  Summary: Contains functions for use in Ecotope Datapipelines
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
File without changes
File without changes
File without changes