In the Lecture_2.ipynb
example code is:
AttributeError: 'float' object has no attribute 'round'
This is incorrect and should be:
Same with the median as well.
Version of python: 3.10.5
Version of pandas: 1.4.2-1
I tried both the ways with some other data set and it was working fine. Can you share the link to your code?
There is no link to the code, I did it in jupyter and used the example ipynb provided.
I have a feeling you may be on an older version of python / pandas than the ones I listed.
This is documented here:
It does state " For a general Python object
round delegates to
This does not appear to work as a method of a dataframe in this instance. Could it be a possible change in pandas?
That’s weird… for a start, I just tested it in the dataframe I’m currently working on and it doesn’t cause an error.
But also I’m wondering about the datatype. Like, it should be “numpy.float64” not just “float”.
So yeah, hard to say what the problem is without the actual code… but yeah, this shouldn’t cause an error.
Why do you folks keep saying this?
I literally pasted the code at the top and nothing else was changed in the example since it’s the lecture code.
You have not stated what version of pandas and python you are using to test so how would we be able to know if it’s a regression caused by a version difference?
Because that’s how you ask a question: you provide the sourcecode and ask a question about it.
Right now I would need to look through the course and look for the file in hopes to find it.
Plus versions don’t matter, Pandas is built from the ground up to utilize Numpy. So the fact you didn’t end up with a pandas nor numpy datatype indicates an error somewhere in the previous code.
I am submitting a bug report, not asking a question. This post is for whoever maintains the lesson so they can look into why this is occurring with the latest version of pandas and python.
Yes, you would need to open the course file that I did not edit (other than testing the new line that I provided) and which I already documented in the very first post. If that’s too much work then please don’t respond to the post as you’re just wasting time.
A bug report should also include a link to the lection and/or code. I don’t know why you make such a fuss about including a link to something you know exactly where it is.
I would need to find it first, because you didn’t include a link there…
The course consists of 37 different lections - You expect someone to go through all 37 in hopes of finding the file you are referring to because you are to lazy to just post the link to wherever you are right now?
Plus as we already said, not only should the function work, the error itself doesn’t even make sense in this context…
Look, we are all happy about someone trying to help make the courses better. But you REALLY should work on your attitude because we are trying the same and you make it very hard for us to do so.
No, I expect them to read the title which gives the course name and then read the description that gives the exact file in question.
And why do you expect that, instead of just giving the link?
Also I tried that and didn’t even find the course with this exact name, let alone the file.
Which again begs the question, why do you make such a fuss about it? Just share the link, given you know exactly where to look. I can’t comprehend what your problem is…
So now I got bored and annoyed and turns out the files are in Example A - GitHub - ine-rmotr-curriculum/FreeCodeCamp-Pandas-Real-Life-Example
And after downloading it and running the thing with python 3.10.5 and pandas 1.4.3 → it works without error.
At this point I’d ask you to update Pandas to the most recent version and try running it again. But given the age of the course, it’s propably written with an older version and appearently worked - so unless you actually didn’t run the code properly, the only other possibility is that you somehow picked up a broken Pandas version.
Anyway, thanks for the report, but there is no problem with the files and so the problem must be on your end.