Skip to content

Commit

Permalink
fix assignment warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rdnfn committed Nov 5, 2024
1 parent d78d510 commit d19ff5b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/inverse_cai/app/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ def compute_metrics(votes_df: pd.DataFrame, baseline_metrics: dict = None) -> di
metrics = {}

# slightly faster to make data types categorical
votes_df["principle"] = votes_df["principle"].astype("category")
votes_df["vote"] = votes_df["vote"].astype("category")
votes_df = votes_df.assign(
principle=votes_df["principle"].astype("category"),
vote=votes_df["vote"].astype("category"),
)

# more efficient than doing operation for each principle group separately
value_counts_all = (
Expand Down

0 comments on commit d19ff5b

Please sign in to comment.