-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error when running cell 777 #5
Comments
Have you found a solution? please |
i considered it as a list and removed the to_dict command but then there is another error it would really be useful if someone could help |
I am not sure how this is supposed to work with iloc, but replacing the line
by
produces sensible results |
I got the same error. It could be found that the df. agg() returned a Series instead of a Dataframe, so I transformed it. this is workaround below. grouped_columns = df.loc[partition].agg(aggregations, squeeze=False)
sensitive_counts = df.loc[partition].groupby(sensitive_column).agg({sensitive_column : 'count'})
#insert
df2=grouped_columns.to_frame()
grouped_columns=pd.DataFrame(df2.values.T,columns=df2.index)
#insert_end |
AttributeError Traceback (most recent call last)
in
----> 1 dfn = build_anonymized_dataset(df, finished_partitions, feature_columns, sensitive_column)
in build_anonymized_dataset(df, partitions, feature_columns, sensitive_column, max_partitions)
14 grouped_columns = df.loc[partition].agg(aggregations, squeeze=False)
15 sensitive_counts = df.loc[partition].groupby(sensitive_column).agg({sensitive_column : 'count'})
---> 16 values = grouped_columns.iloc[0].to_dict()
17 for sensitive_value, count in sensitive_counts[sensitive_column].items():
18 if count == 0:
AttributeError: 'list' object has no attribute 'to_dict'
The text was updated successfully, but these errors were encountered: