From 70cada8bb80bc08e63f471e7ce3ea64a57980489 Mon Sep 17 00:00:00 2001 From: junos Date: Wed, 15 Dec 2021 16:14:33 +0100 Subject: [PATCH] Consider a subset of columns when dropping. --- .../heatmap_sensors_per_minute_per_time_segment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/visualization/heatmap_sensors_per_minute_per_time_segment.py b/src/visualization/heatmap_sensors_per_minute_per_time_segment.py index 5be1b897..d3ea200a 100644 --- a/src/visualization/heatmap_sensors_per_minute_per_time_segment.py +++ b/src/visualization/heatmap_sensors_per_minute_per_time_segment.py @@ -38,7 +38,7 @@ def getDataForPlot(phone_data_yield_per_segment): for columns in columns_for_full_index: full_index = full_index + columns full_index = pd.MultiIndex.from_tuples(full_index, names=("local_segment_start_datetimes", "minutes_after_segment_start")) - phone_data_yield_per_segment = phone_data_yield_per_segment[["local_segment_start_datetimes", "minutes_after_segment_start"]].drop_duplicates(keep="first") + phone_data_yield_per_segment = phone_data_yield_per_segment.drop_duplicates(subset=["local_segment_start_datetimes", "minutes_after_segment_start"], keep="first") phone_data_yield_per_segment = phone_data_yield_per_segment.set_index(["local_segment_start_datetimes", "minutes_after_segment_start"]).reindex(full_index).reset_index().fillna(0) # transpose the dataframe per local start datetime of the segment and discard the useless index layer