image_output_11.png image_output_17.png image_output_14.png image_output_13.png image_output_5.png image_output_18.png image_output_21.png image_output_7.png image_output_20.png image_output_4.png image_output_8.png image_output_16.png image_output_6.png image_output_12.png text_plain_output_1.png image_output_3.png image_output_2.png image_output_1.png image_output_10.png image_output_15.png image_output_9.png image_output_19.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

data_df = pd.read_csv('../input/mushrooms.csv')

data_df['y'] = data_df['class'].map({'p': 1, 'e': 0})
columns = [c for c in data_df.columns if not c in ('class', 'y')]
single_val_c = {}
for i, c in enumerate(columns):
    if data_df[c].nunique() == 1:
        single_val_c[c] = data_df[c].unique()[0]
        continue
    s = data_df.groupby(c)['y'].mean()
    sns.barplot(x=s.index, y=s)
    plt.show()
for c in single_val_c.keys():
    print('The column %s only has one unique value with %r' % (c, single_val_c[c]))