Consider a subset of columns when dropping.

labels
junos 2021-12-15 16:14:33 +01:00
parent d2ed73dccf
commit 70cada8bb8
1 changed files with 1 additions and 1 deletions

View File

@ -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