Skip to content
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

AttributeError: 'Series' object has no attribute 'iteritems' when plotting disparity with Aequitas #207

Open
Sparsh009 opened this issue Sep 16, 2024 · 1 comment

Comments

@Sparsh009
Copy link

Description: When trying to plot disparity using the Aequitas plot_disparity function, I encountered the following error:

csharp
Copy code
AttributeError: 'Series' object has no attribute 'iteritems'
This occurs when trying to visualize disparities with the following line of code:

python
Copy code
ap.disparity(bdf, metrics, 'Age_Level', fairness_threshold=disparity_tolerance)
Steps to Reproduce:

Initialize the Aequitas Plot object.
Attempt to call ap.disparity(bdf, metrics, 'Age_Level', fairness_threshold=disparity_tolerance) using a precomputed bdf DataFrame.
The error occurs when trying to convert the data to a dictionary for visualization.
Expected Behavior: The disparity plot should be displayed for the specified metrics and attribute ('Age_Level') without raising an error.

Environment:

Python version: (e.g., 3.10)
Aequitas version: (e.g., latest)
Pandas version: (e.g., 1.3.0)
Altair version: (e.g., 4.0)
Additional Context: This error seems to be related to how Altair processes Pandas DataFrames. The iteritems method has been deprecated in recent versions of Pandas and replaced by items. This might be causing the issue during data transformation.

Please advise on how to resolve this or if a fix can be applied.

@colton-lapp
Copy link

Just wanted to +1 to this issue and note that it breaks the following Jupyter notebook demo:
https://github.com/dssg/fairness_tutorial/blob/master/notebooks/single_model_audit.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants