Hi,
I am trying to work out two failed tests:
Reasons:
Expected a different number of bars chart.
Expected line plot xlabel to be ‘variable’
Here is how my code looks leading up to the bar chart.
First normalizing values:
df[‘cholesterol’] = np.where(df[‘cholesterol’] > 1, 1, 0)
df[‘gluc’] = np.where(df[‘gluc’] > 1, 1, 0)
Using melt to change the shape of my df:
df_cat = pd.melt(df, id_vars=[‘cardio’], value_vars=[‘active’, ‘alco’, ‘cholesterol’, ‘gluc’, ‘overweight’, ‘smoke’])
It is generating the two bar charts for cardio=0 and cardio=1, however the ranger in the y-axis is 0 to 1, i.e. it is using the value rather than the total (what you see in the example graph) for this axis. Been looking at some online documentation but I haven’t been able to resolve this yet.
Hi! I have the same issue (Almost) with the number of bars chart:
AssertionError: 25 != 13 : Expected a different number of bars chart.
(but my chart looks exactly like the one in the figure)
Did you find any solution? I tried to change the catplot to kind=bar, like craig.lunney suggested, but I keep getting the same error… I don’t know if maybe there’s something like a merge thing we can do with the bars… I’m running out of ideas here
Thanks!
Fixed it! what happened was when I wrote the code from my jupyter notebook, I forgot to add the code line that changes the value of ‘gluc’ to 0 or 1 , so I was having too many values for the ‘value’ col (not only 0s or 1s) that’s why the test didn’t succeed.
I hope this helps anyone
Thanks!