selbl commited on
Commit
5c3185b
1 Parent(s): 7290c29

Added support for AM and PM time formats

Browse files
Files changed (1) hide show
  1. script.py +2 -2
script.py CHANGED
@@ -308,8 +308,8 @@ def WhatsappAnalysis(df,nombregrupo,savefigs=False,directory=''):
308
  st.pyplot(plt.gcf())
309
 
310
  # Assuming 'Time' is in the format 'HH:MM:SS'. If not, adjust the format accordingly.
311
- dfFilter['Activation_Time'] = pd.to_datetime(dfFilter['Time'], format='%H:%M').dt.hour
312
-
313
  # Plot a histogram of message activation times
314
  plt.figure(figsize=(10, 6))
315
  plt.hist(dfFilter['Activation_Time'], bins=24, edgecolor='black', alpha=0.7)
 
308
  st.pyplot(plt.gcf())
309
 
310
  # Assuming 'Time' is in the format 'HH:MM:SS'. If not, adjust the format accordingly.
311
+ #dfFilter['Activation_Time'] = pd.to_datetime(dfFilter['Time'], format='%H:%M').dt.hour
312
+ dfFilter['Activation_Time'] = pd.to_datetime(dfFilter['Time'], format='mixed').dt.hour
313
  # Plot a histogram of message activation times
314
  plt.figure(figsize=(10, 6))
315
  plt.hist(dfFilter['Activation_Time'], bins=24, edgecolor='black', alpha=0.7)