You can pd.melt
setting Names
as id_vars
and use seaborn'ssns.catplot
:
import pandas as pd
import seaborn as sns
sns.catplot(data=(pd.melt(df, id_vars='Names')
.rename(columns={'variable':'x-axis', 'value':'y-axis'})),
x='x-axis',
y='y-axis',
hue='Names',
kind='bar',
height=6,
aspect=1.5)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.