Вы можете использовать barplot
здесь.Я не был уверен на 100% в том, чего вы на самом деле хотите достичь, поэтому я разработал несколько решений.
Частота успешных (неуспешных) на всех успешных (неудачных)
fig, axes = plt.subplots(2, 2, figsize=(15, 10))
mainDf['frequency'] = 0 # a dummy column to refer to
for col, ax in zip(['page_name', 'weekday', 'type', 'industry'], axes.flatten()):
counts = mainDf.groupby([col, 'successful']).count()
freq_per_group = counts.div(counts.groupby('successful').transform('sum')).reset_index()
sns.barplot(x=col, y='frequency', hue='successful', data=freq_per_group, ax=ax)
![enter image description here](https://i.stack.imgur.com/TnrBD.png)
Частота успешных (неудачных) на группу
fig, axes = plt.subplots(2, 2, figsize=(15, 10))
mainDf['frequency'] = 0 # a dummy column to refer to
for col, ax in zip(['page_name', 'weekday', 'type', 'industry'], axes.flatten()):
counts = mainDf.groupby([col, 'successful']).count()
freq_per_group = counts.div(counts.groupby(col).transform('sum')).reset_index()
sns.barplot(x=col, y='frequency', hue='successful', data=freq_per_group, ax=ax)
, что на основе предоставленных вами данных,дает
![enter image description here](https://i.stack.imgur.com/mJQ8J.png)
Частота успешных (неуспешных) операций в общей сложности
fig, axes = plt.subplots(2, 2, figsize=(15, 10))
mainDf['frequency'] = 0 # a dummy column to refer to
total = len(mainDf)
for col, ax in zip(['page_name', 'weekday', 'type', 'industry'], axes.flatten()):
counts = mainDf.groupby([col, 'successful']).count()
freq_per_total = counts.div(total).reset_index()
sns.barplot(x=col, y='frequency', hue='successful', data=freq_per_total, ax=ax)
![enter image description here](https://i.stack.imgur.com/ApdRC.png)