rapids/src/features/light_metrics.py

13 lines
737 B
Python
Raw Normal View History

2020-01-14 15:51:39 +01:00
import pandas as pd
2020-04-02 00:29:53 +02:00
from light.light_base import base_light_features
2020-01-14 15:51:39 +01:00
light_data = pd.read_csv(snakemake.input[0], parse_dates=["local_date_time", "local_date"])
day_segment = snakemake.params["day_segment"]
metrics = snakemake.params["metrics"]
2020-04-02 00:29:53 +02:00
light_features = pd.DataFrame(columns=["local_date"])
2020-01-14 15:51:39 +01:00
2020-04-02 00:29:53 +02:00
light_features = light_features.merge(base_light_features(light_data, day_segment, metrics), on="local_date", how="outer")
assert len(metrics) + 1 == light_features.shape[1], "The number of features in the output dataframe (=" + str(light_features.shape[1]) + ") does not match the expected value (=" + str(len(metrics)) + " + 1). Verify your light feature extraction functions"
2020-01-14 15:51:39 +01:00
light_features.to_csv(snakemake.output[0], index=False)