hello people. this task isnt that much hard, however i have one “maybe bug” problem, and one “question”.
i tried to solve it and google it, but no success.
First is “bug”. When i type this code at the end of “draw heatmap()” function i got redline on my replit … while that code works nice in jupyter notebook;
fig, ax = plt.subplots(figsize=(12,12)) -i dont know why i get redline on replit code under this line, that throws error , while its working nice on jupyter. … i tried various ways, everytime i type “fig” its an error … is there something that i am missing?
and second… when i was about to “clean data” in draw_heat_map() function, i started with “drop”… it didnt work… latter i checked for “solutions” and found that this simple codes works…
# Clean the data
# i have used “drop” function before but apparently results were incorrect. is there #any way to use drop as alternative? #for example this is not working
#HOWEVER - i still want to go with my first idea to “drop” everything that i dont #need… #for example why this is not working? is there anyway to drop all those rows that #doesnt satisfy our needs?
# df4.drop(df4[ (df4[‘height’] <= df4[‘height’].quantile(0.025)) & (df4[‘height’] >= df4[‘height’].quantile(0.975))].index, inplace=True)
This bit is easy. You are missing a close parenthesis here:
So, definitely a bug in your code. As for the drop versus select problem, it looks just like the simultaneous selections versus sequential selection problem that has been discussed here before. When I modify your code with the drop version, it works but generates a very slightly different heatmap. If I compare two separate dataframes and drop one and select the other and display the shapes, I get
dropped: (70000, 14)
selected: (63259, 14)
Since the data has 70,000 entries to begin, nothing is dropped. So the drop is not working the way you think (apparently no line meets all 5 conditions). If I do 5 sequential drops with the correct conditions, the cleaned data frames are identical and the tests pass. So, you can drop or select and either will work as long as they are done correctly, as one would expect.
Lastly, Jupyter notebooks have all manner of problems when you leave the “notebook” realm (read, like Matlab or Mathematica) and enter the programming realm. So it’s never surprising some things work in Jupyter that won’t with a Python interpreter, and vice versa.
thanks. first sorry for late reply, i was busy with another job, then in free time i fixed this mistake and i got problem that sns catplot doesnt recognize change name on y axis… after lot of google and trying i fixed that as well, and it passed all tests.
so thank you. however;
If I do 5 sequential drops with the correct conditions, the cleaned data frames are identical and the tests pass. So, you can drop or select and either will work as long as they are done correctly, as one would expect.
can you pls give me one example , because i started with “that idea” i google everyway how to drop all those rows at once but couldnt do it properly… i want to learn where it was my mistake.