Skip to content

Commit

Permalink
sort column order by latest date count
Browse files Browse the repository at this point in the history
  • Loading branch information
anomal committed May 19, 2021
1 parent a7c0e2c commit 6e9e9ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion _notebooks/canada_voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def join(df, area, variant):
return pd.merge(df, dfarea, how="left", left_on=[date_name], right_on=[date_name])

def create_table(variant):
df_max = dfclean[dfclean["Area"]!="CA"].groupby(["Area"]).max().reset_index()[["Area", variant]].sort_values(by=[variant, "Area"], ascending=[False, True])
date_max = dfclean.max()["report_date"]
df_max = dfclean[(dfclean["Area"]!="CA") & (dfclean["report_date"] == date_max)][["Area", variant]].sort_values(by=[variant, "Area"], ascending=[False, True])
areas = df_max["Area"].tolist()

df_variant = pd.DataFrame()
Expand Down

0 comments on commit 6e9e9ff

Please sign in to comment.