From c6ff0346f4eaca16ce724fb53d76da64aae928bf Mon Sep 17 00:00:00 2001 From: Meng Li <34143965+Meng6@users.noreply.github.com> Date: Thu, 12 Mar 2020 11:26:42 -0400 Subject: [PATCH] Fix bug of screen_metrics.py when df is empty --- src/features/screen_metrics.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/features/screen_metrics.py b/src/features/screen_metrics.py index c662f4e9..09d8c333 100644 --- a/src/features/screen_metrics.py +++ b/src/features/screen_metrics.py @@ -57,6 +57,7 @@ if not screen_deltas.empty: 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 = 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) \ No newline at end of file