Consider a subset of columns when dropping.
parent
d2ed73dccf
commit
70cada8bb8
|
@ -38,7 +38,7 @@ def getDataForPlot(phone_data_yield_per_segment):
|
||||||
for columns in columns_for_full_index:
|
for columns in columns_for_full_index:
|
||||||
full_index = full_index + columns
|
full_index = full_index + columns
|
||||||
full_index = pd.MultiIndex.from_tuples(full_index, names=("local_segment_start_datetimes", "minutes_after_segment_start"))
|
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)
|
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
|
# transpose the dataframe per local start datetime of the segment and discard the useless index layer
|
||||||
|
|
Loading…
Reference in New Issue