Skip to content

Commit

Permalink
Fix daily resample
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbelgium authored Mar 5, 2025
1 parent 8a4b54c commit a6d0c3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/plotly_streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,15 @@ def hms_to_str(t):
fig = make_subplots(rows=1, cols=1)

df4 = df2['Com_Name'][df2['Com_Name'] == specie].resample('15min').count()
df4.index = pd.MultiIndex.from_arrays([df4.index.date, df4.index.time], names=['date', 'time'])
day_hour_freq = df4.unstack(level='time').fillna(0)
df4.index = [df4.index.date, df4.index.time]
day_hour_freq = df4.unstack().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()]
fig_x = [d.strftime('%d-%m-%Y') for d in day_hour_freq.index.tolist()]
fig_y = [h.strftime('%H:%M') for h in day_hour_freq.columns.tolist()]
day_hour_freq.columns = fig_dec_y
fig_z = day_hour_freq.values.transpose()
fig_z = day_hour_freq.values.transpose().tolist()

color_pals = px.colors.named_colorscales()
selected_pal = st.sidebar.selectbox('Select Color Pallet for Daily Detections', color_pals)
Expand Down

0 comments on commit a6d0c3f

Please sign in to comment.