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’])
And finally drawing the plot.
fig, ax = plt.subplots(figsize=(16, 12))
g = sns.catplot(data=df_cat, kind= ‘count’, x= ‘variable’, hue=‘value’, col=‘cardio’, y= None)
I appreciate any tips to fix this issue.
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
.
Challenge: Medical Data Visualizer
Link to the challenge: