Closed Anindya911 closed 5 years ago
of course! Could you please give me some context so that I could reproduce the error?
I was trying to find the largest value of a column of a dataset and then display it.
display(nobel.nlargest(1, "age"))
this is the line of code i used. nobel is the dataframe name
I am a newbie to this field and trying to learn
Are you using pandas dataframes (hence the reference to columns?) If you have a column, let's say it's named "age", you should be able to do:
nobel['age'].max()
You shouldn't need to use any sort of display().
Also, if you are having (general trouble) or questions with python, dataframes, it's probably best to try stack overflow or a Github board relevant to the software you are using. pydicom/deid is a python module for working with dicom datasets, specifically headers.
okay, thanks for the help vsoch. well it was instructed to use display,otherwise i wouldve also opted for max(). Anyway thanks. I will try stack overflow or Github board now onwards
Interesting! I've never used display, and I'm a big fan of ipython. If you want to show me where the instruction is to do this, I'd be interested to take a look.
And keep it up with your learning! I remember the general wisdom that it takes 10 years to learn a language really well, and these early stages when you are copying pasting a lot of errors into Google, or asking questions, are the harder bits. As long as you don't give up, you will be successful.
I was doing a project on datacamp where i came across this. here is the link to the project
https://projects.datacamp.com/projects/441
And thanks for the advice vsoch, means a lot :-)
Hello! I did the same project on Datacamp, and for some reason, it worked removing display, not using anything. Probably is an error that they have there.
Awesome! Thanks for sharing - others that find the issue here will know to just leave it out.
Why is this error related to deid?
I have the same issue on the same Datacamp task, how did you resolve it please ?
I removed display() as advised by MAStarsis and it worked.
Thanx! Had the very same problem with DataCamp task and couldn't figure out what's wrong. Removing display() helped.
Actually, you just need to keep only the first display() and remove the second. I think the aim of this task was to show how the display() function is working, but the question is formulated in somewhat tricky way. I think they wanted the students to repeat the same task as they did in question 2.
Found this problem on Datacamp. Sad to see they have such silly errors even after two years.
It’s also very funny that the issue reported and discussed here has nothing to do with the library at hand!
Like @ayepremyan said: it's not an issue BUT:
display(nobel.nlargest(1, 'age'))
nobel.nsmallest(1, 'age')
all works fine.
However, if you try this:
display(nobel['age'].nlargest(1)
nobel['age'].nsmallest(1)
you will be getting the error message.
Like @ayepremyan said: it's not an issue BUT:
- if you code
display(nobel.nlargest(1, 'age')) nobel.nsmallest(1, 'age')
all works fine.
However, if you try this:
display(nobel['age'].nlargest(1) nobel['age'].nsmallest(1)
you will be getting the error message.
This is correct. I worked on the same project. As for the reason, it is a default behavior in Jupyter Notebook:
'By default, a Jupyter Notebook (which is where you are working right now) will only show the final output in a cell. If you want to show intermediate results, you will have to use the display() function.'
So use the former code snippet in the quoted part of this post.
Can anyone help me on this please ? I was trying to display the largest vale of a column using nlargest method