Skip to content

Commit

Permalink
resolve some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
glassonion1 committed Sep 20, 2024
1 parent 3e61127 commit 28ea9aa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions anonypy/anonymity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def is_t_close(df, partition, sensitive_column, global_freqs, p):
total_count = float(len(partition))
d_max = None
group_counts = (
df.loc[partition].groupby(sensitive_column)[sensitive_column].agg("count")
df.loc[partition]
.groupby(sensitive_column, observed=True)[sensitive_column]
.agg("count")
)
for value, count in group_counts.to_dict().items():
p = count / total_count
Expand All @@ -26,7 +28,9 @@ def is_t_close(df, partition, sensitive_column, global_freqs, p):
def get_global_freq(df, sensitive_column):
global_freqs = {}
total_count = float(len(df))
group_counts = df.groupby(sensitive_column)[sensitive_column].agg("count")
group_counts = df.groupby(sensitive_column, observed=True)[sensitive_column].agg(
"count"
)

for value, count in group_counts.to_dict().items():
p = count / total_count
Expand Down

0 comments on commit 28ea9aa

Please sign in to comment.