bugsyb
bugsyb

Reputation: 6041

Graphing percentage data in seaborn

How would I graph this data in seaborn. I would like to have the various categories on the x axis, and the data on the y axis as percentages.

I tried to create a barplot with seaborn but I can't get it to look right.

Any help would be appreciated!

Thanks

enter image description here

Edit: code:

sns.barplot(x = new_df.columns,data=new_df)

Upvotes: 0

Views: 2397

Answers (1)

Logan
Logan

Reputation: 316

I suggest you organize your DataFrame more like this, it will make it much easier to plot and organize this type of data.

Instead of doing your DataFrame as you have it, instead transpose it to two simple columns like so:

name                 value
debt_consolidation    0.152388
credit_card           0.115689
all_other             0.170111

etc. By doing this you can simply plot your data in Seaborn by doing the below:

sns.barplot(x="name",y="value", data = df)

Which will look like this (click)

Upvotes: 1

Related Questions