Value counts#

from fairlearn.datasets import fetch_diabetes_hospital
import matplotlib.pyplot as plt
fig, ax = plt.subplots()

data = fetch_diabetes_hospital(as_frame=True)
X =
X.drop(columns=["readmitted", "readmit_binary"], inplace=True)
y_true =
race = X['race']

df = race.value_counts().reset_index()["race"], df["count"])
ax.set_title('Counts by race')
ax.tick_params(axis='x', labelrotation=45)

Counts by race
/home/circleci/tmp-fairlearn/examples/ SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation:
  X.drop(columns=["readmitted", "readmit_binary"], inplace=True)

Total running time of the script: (0 minutes 3.337 seconds)

Gallery generated by Sphinx-Gallery