singhsidhukuldeep commited on
Commit
a6efc5f
·
verified ·
1 Parent(s): 7e1d8eb

handling NaN values

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -53,8 +53,8 @@ df["username"] = df.author.apply(lambda x: x["name"])
53
  df["totalReactions"] = df.reactions.apply(lambda x: sum([_["count"] for _ in x]))
54
  df["Num of posts"] = 1
55
 
56
- # Ensure metrics columns are integers
57
- df[metrics] = df[metrics].astype(int)
58
 
59
  data = (
60
  df.groupby(["username", "Name"])[metrics]
 
53
  df["totalReactions"] = df.reactions.apply(lambda x: sum([_["count"] for _ in x]))
54
  df["Num of posts"] = 1
55
 
56
+ # Ensure metrics columns are integers, handling NaN values
57
+ df[metrics] = df[metrics].fillna(0).astype(int)
58
 
59
  data = (
60
  df.groupby(["username", "Name"])[metrics]