Seaborn barchart for frequency of data
-
02-11-2019 - |
Question
I'm trying to plot a bar chart to represent the frequency of two variables (Dead and Alive) in my test and training data. I want it to look like the second example described in the documentation (minus the error bars).
Currently i have
yfreq = pd.DataFrame(data = [Counter(Ytrain),Counter(Ytest)],
index = ['Train','Test'])
yfreq.columns = ['Dead', 'Alive']
print(yfreq)
>>> Dead Alive
Train 384 239
Test 165 103
And then for the graph
sns.barplot(data = yfreq)
Which correctly outputs a graph but does not split the data into test and training data.
I know it has something to do with the hue
kwarg but i can't work out how too do it.
Thanks in advance
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange