While doing my 3rd project on Replit I faced the following problem (error while testing):
" fig.savefig(‘catplot.png’) NameError: name ‘fig’ is not defined exit status 1 "
The problem is that the system writes about '“fig” and this part of code is not mine. There is a code which was ready and you are not supposed to change it. “fig” belongs to code which is written in two lines after " # Do not modify the next two lines"
Could someone give me a hand?
can’t go on without your help((((
The Medical Data Visualisor exercise?
The problem is, I think, that the exercise guides you into a bad assignment to fig. The save needs to point to the figure within this data type.
This forum gave me (the rather ugly) fix below - before you use the save.
fig = fig.fig
A post was split to a new topic: Python discord bot help
A post was merged into an existing topic: Python discord bot help
Thanks a lot… yes that’s ‘The Medical Data Visualisor exercise?’
I’ve found all errors except one
Can’t find it… My heatmap differ in some digits with that from the test. I compared my plot and the plot from the test. It looks as if I have some error with weight and height weach I cleaned but I can understand what’s wrong.
Asking for help from experienced colleagues
that’s the link for my code:
boilerplate-medical-data-visualizer-3 - Replit
Your sidebar colour scale looks to need tuning.
Think that was a vmax and vmin parameters in heatmap call.
Ah, I think I see your maths error - i fell for the same trick!
You drop the lower 2.5%. THEN you drop the upper 2.5% of what is left.
It is not the same as dropping the lower and upper 2.5% in one go!
That’s looks half true, thanks!
I’ve made corrections (all drop method in one line). Result has changed but as I see one digit is different (low row of the triangle (0.2 vs 0.1)).
I continued to solve what was wrong… and found the solution on forum.
- change overweight calculation.
But in the end I did not understand why is difference when you make all calculation in one line here and if you calculate BodyIndex first and then turn them to 0/1…
- Also, I had to change clean the data part…instead of dropping lines which do not correspond to conditions, I’ve made new table heat_map… Again I didn’t get what was wrong, as in Jupyter notebook all was well
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.