I am working with the Portuguese Bank Marketing dataset http://archive.ics.uci.edu/ml/datasets/Bank+Marketing#
I would like to visualise the conversion rate per some categorical feature eg occupation or marital status.
Using pandas groupby() as show below
df.groupby(["marital","y"])["y"].count().plot(kind="bar")
However, I would like to create a more readable graph, similar to the ones in seaborn tutorials. Where X is some categorical feature, Y is some value and the Hue groups them per some other metric.
My attempts so far result in the following errors:
sns.catplot(x = df["job"].value_counts().index,
y = df["job"].value_counts().values,
hue="y",
data=df,
kind="bar")
ValueError: Grouper and axis must be same length
Any pointers will be appreciated!
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.