Bug fix: if df has no rows write an empty zscore file.
parent
21eb2665d7
commit
788ac31190
|
@ -21,17 +21,20 @@ if provider_key == "cr":
|
||||||
|
|
||||||
windows_features_data = pd.read_csv(sensor_data_files["windows_features_data"])
|
windows_features_data = pd.read_csv(sensor_data_files["windows_features_data"])
|
||||||
excluded_columns = ['local_segment', 'local_segment_label', 'local_segment_start_datetime', 'local_segment_end_datetime', prefix + "level_1"]
|
excluded_columns = ['local_segment', 'local_segment_label', 'local_segment_start_datetime', 'local_segment_end_datetime', prefix + "level_1"]
|
||||||
windows_features_data.loc[:, ~windows_features_data.columns.isin(excluded_columns)] = \
|
|
||||||
StandardScaler().fit_transform(windows_features_data.loc[:, ~windows_features_data.columns.isin(excluded_columns)])
|
|
||||||
|
|
||||||
windows_features_data.to_csv(snakemake.output[1], index=False)
|
if windows_features_data.empty:
|
||||||
|
windows_features_data.to_csv(snakemake.output[1], index=False)
|
||||||
if provider_main["WINDOWS"]["COMPUTE"] and "SECOND_ORDER_FEATURES" in provider_main["WINDOWS"]:
|
windows_features_data.to_csv(snakemake.output[0], index=False)
|
||||||
so_features_names = provider_main["WINDOWS"]["SECOND_ORDER_FEATURES"]
|
|
||||||
windows_so_features_data = extract_second_order_features(windows_features_data, so_features_names, prefix)
|
|
||||||
windows_so_features_data.to_csv(snakemake.output[0], index=False)
|
|
||||||
else:
|
else:
|
||||||
pd.DataFrame().to_csv(snakemake.output[0], index=False)
|
windows_features_data.loc[:, ~windows_features_data.columns.isin(excluded_columns)] = \
|
||||||
|
StandardScaler().fit_transform(windows_features_data.loc[:, ~windows_features_data.columns.isin(excluded_columns)])
|
||||||
|
|
||||||
|
windows_features_data.to_csv(snakemake.output[1], index=False)
|
||||||
|
|
||||||
|
if provider_main["WINDOWS"]["COMPUTE"] and "SECOND_ORDER_FEATURES" in provider_main["WINDOWS"]:
|
||||||
|
so_features_names = provider_main["WINDOWS"]["SECOND_ORDER_FEATURES"]
|
||||||
|
windows_so_features_data = extract_second_order_features(windows_features_data, so_features_names, prefix)
|
||||||
|
windows_so_features_data.to_csv(snakemake.output[0], index=False)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
pass #To-Do for the rest of the sensors.
|
pass #To-Do for the rest of the sensors.
|
Loading…
Reference in New Issue