Skip to content

Commit

Permalink
Merge pull request #4 from tzuV/patch-1
Browse files Browse the repository at this point in the history
Update anonypy.py to handle df instead of series for the ".to_dict()" function.
  • Loading branch information
glassonion1 authored Aug 4, 2024
2 parents f43ef85 + 6b35ad9 commit ea4f0a7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions anonypy/anonypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def anonymize(df, partitions, feature_columns, sensitive_column, max_partitions=
sensitive_counts = (
df.loc[partition].groupby(sensitive_column).agg({sensitive_column: "count"})
)
grouped_columns = pd.DataFrame(grouped_columns.tolist(), index=grouped_columns.index).T
values = grouped_columns.apply(lambda x: x[0]).to_dict()
for sensitive_value, count in sensitive_counts[sensitive_column].items():
if count == 0:
Expand Down

0 comments on commit ea4f0a7

Please sign in to comment.