Reputation: 1317
I am reading data from four separate files of different categories and would like to visualize the distribution of a filed for those using a violin plot. In my attempt, it seems like they are getting overwritten
import seaborn as sb
# category1, category2, category3, category4 are pandas dataFrame obj
sb.violinplot(category1['delay'])
sb.violinplot(category2['delay'])
sb.violinplot(category3['delay'])
sb.violinplot(category4['delay'])
Upvotes: 2
Views: 2900
Reputation: 25199
You may try:
import seaborn as sns
df = pd.DataFrame({'col1': np.random.rand(100), 'col2': np.random.rand(100)})
sns.violinplot(data=df);
or, if you need to combine several df's of yours:
df = pd.concat([category1['delay'],
category2['delay'],
category3['delay'],
category4['delay']],
axis=1)
sns.violinplot(data=df);
Upvotes: 3