Fix bug of screen_metrics.py when df is empty

pull/95/head
Meng Li 2020-03-12 11:26:42 -04:00
parent 23085aac2a
commit c6ff0346f4
1 changed files with 2 additions and 1 deletions

View File

@ -57,6 +57,7 @@ if not screen_deltas.empty:
for episode in episode_types: for episode in episode_types:
screen_features = pd.concat([screen_features, getEpisodeDurationFeatures(screen_deltas, episode, metrics_deltas, phone_sensed_bins, bin_size, reference_hour_first_use)], axis=1) screen_features = pd.concat([screen_features, getEpisodeDurationFeatures(screen_deltas, episode, metrics_deltas, phone_sensed_bins, bin_size, reference_hour_first_use)], axis=1)
screen_features = screen_features.rename_axis("local_date").reset_index() if not screen_features.empty:
screen_features = screen_features.rename_axis("local_date").reset_index()
screen_features.to_csv(snakemake.output[0], index=False) screen_features.to_csv(snakemake.output[0], index=False)