Closed junoslukan closed 2 years ago
Thanks for reporting! @Meng6 could you take a look please?
Hi @junoslukan, thanks for reporting! I updated the code in https://github.com/carissalow/rapids/commit/8a24ad5be51ddcd43b1cbdac5815f2a8963a0840. You can pull the latest code from the plots/fixbug#169
branch. Please let me know if you still get errors.
Let's meerge
The rule
heatmap_sensors_per_minute_per_time_segment
throws the following error:I do not have a minimal example at hand, but I have debugged the problem enough so that I can hopefully explain what I think is going on. I have provided a mock-up example below.
As seen from the traceback, the dataframe
phone_data_yield_per_segment
should be reindex withfull_index
, but the existing index.set_index(["local_segment_start_datetimes", "minutes_after_segment_start"])
is not unique.This index is created earlier by first selecting the maximum
local_date_time
(andsensor
) within a segment and the local minute, in this line:Next, the
minutes_after_segment_start
are calculated by considering the Timedelta in minutes betweenlocal_date_time
andlocal_segment_start_datetimes
:It is this cast to int (acting as
floor
effectively) that creates duplicates in the index later on.Consider the following example:
After calculating
minutes_after_segment_start
as above, we get:This creates the problem with non-unique index.
A workaround would be to first drop duplicates on indexing columns in
getDataForPlot()
, but I am not sure if this is actually the desired outcome: