Amitsingh0823
Amitsingh0823

Reputation: 91

How to make Seaborn plot graph

I want to make bar graph btw the Employment Status and the counts of the status . i want to plot from seaborn library and palette = "viridis" .

df_loan_2['EmploymentStatus'].value_counts()

Employed         67310
Full-time         7927
Self-employed     4538
Other             3806
Not employed       649
Retired            367
Part-time          256
Name: sum, dtype: int64

In matplotlib code is this

df_loan_2['EmploymentStatus'].value_counts().plot(kind='barh',color='red')
plt.title('EmploymentStatus')
plt.xlabel('count')
plt.ylabel('status')
plt.fontsize = 12
plt.figsize=(12,12)

Upvotes: 1

Views: 54

Answers (1)

Sahith Kurapati
Sahith Kurapati

Reputation: 1715

You can do it like so with barplot:

import seaborn as sns
sns.barplot(x=df_loan_2['EmploymentStatus'].value_counts().index, y=df_loan_2['EmploymentStatus'].value_counts())

Or you can do it with a countplot in seaborn in an easier way:

sns.countplot(x='EmploymentStatus', data=df_loan_2)

Upvotes: 1

Related Questions