Tuesday, October 03, 2017

A Horizontal Bar Chart (Plot) with Seaborn (Python)

 Why? Coz Seaborn gives you something better looking by default :)


series1= starterDf['col_of_interest'].value_counts()


df_for_sns = series1.rename_axis('col_of_interest').reset_index(name='counts') #change counts if you w

import seaborn as sns
sns.set_style('white') # if you want..

sns.barplot( y='col_of_interest', x="counts", data=df_for_sns)
sns.despine( top=True, bottom=True , left=True, right=True )


Thanks to : https://stackoverflow.com/questions/47136436/python-pandas-convert-value-counts-output-to-dataframe

No comments: