From 93a2157262b1b0b0276b4653ec91c7396da907a7 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 5 Mar 2025 08:40:11 +0100 Subject: [PATCH] Fix daily resample --- scripts/plotly_streamlit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.py index 6e2d1a0..4ad8e1e 100755 --- a/scripts/plotly_streamlit.py +++ b/scripts/plotly_streamlit.py @@ -382,8 +382,8 @@ if daily is False: fig = make_subplots(rows=1, cols=1) df4 = df2['Com_Name'][df2['Com_Name'] == specie].resample('15min').count() - df4.index = [df4.index.date, df4.index.time] - day_hour_freq = df4.unstack().fillna(0) + df4.index = pd.MultiIndex.from_arrays([df4.index.date, df4.index.time], names=['date', 'time']) + day_hour_freq = df4.unstack(level='time').fillna(0) saved_time_labels = [hms_to_str(h) for h in day_hour_freq.columns.tolist()] fig_dec_y = [hms_to_dec(h) for h in day_hour_freq.columns.tolist()]