Skip to content

Commit

Permalink
fix AttributeError: Can only use .dt accessor with datetimelike values
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Feb 5, 2024
1 parent 3ac7299 commit 0d258f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions recipes/VideoBotsStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,11 @@ def calculate_stats_binned_by_time(
) * 100
df["Msgs_per_convo"] = df["Messages_Sent"] / df["Convos"]
df["Msgs_per_user"] = df["Messages_Sent"] / df["Senders"]
df["Average_response_time"] = (
df["Average_response_time"].dt.total_seconds() * factor
)
try:
df["Average_response_time"] = df["Average_response_time"].dt.total_seconds()
except AttributeError:
pass
df["Average_response_time"] = df["Average_response_time"] * factor
df.fillna(0, inplace=True)
df = df.round(0).astype("int32", errors="ignore")
return df
Expand Down

0 comments on commit 0d258f4

Please sign in to comment.