Python Medical Data Visualizer - Feedback + help with weird errors

Hi everyone!

I just finished with the python medical data visualizer project (I think!). The figure I get seems to match the one that was provided, but it still gives me some weird errors.

Here’s the link:
Project

Any feedback is very much appreciated!

Thanks,
Marcus

Hi snjegu,

same error occurred to me, but I was able to resolve it in the following way:

Instead of producing the figure like you did in your code:

fig = sns.catplot(data=df_cat, col='cardio',kind='count',hue='value',x='variable',order=('active','alco','cholesterol','gluc','overweight','smoke'))

you should instead do it the following way:

g = sns.catplot(data=df_cat, col='cardio',kind='count',hue='value',x='variable',order=('active','alco','cholesterol','gluc','overweight','smoke'))
g.set_axis_labels("variable", "total")
fig = g.fig

The theory behind the code is that sns.catplot() returns a FacetGrid-Object which itself doesn’t have any children (it seems to be an nd-array like the error message says), but it has an attribute (namely the .fig see the last line), which is a Figure-Object, so at last all the tests should pass.

Good luck,

Helmut

Thanks Helmut, I will look into it!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.