Method df.dropna() returns different results compared to my laptop

Hello all.

I was testing the df.dropna() method on the same provided dataset (train.csv) on my laptop, seems that when running the method, it returns 712 rows on dataquest, but 183 rows on my laptop. Any clues on what is causing this? could it be the pandas version? (pandas on laptop is 1.0.5).

Thanks.

Please make sure that when you ask questions -

  1. Share the link to the Mission/Mission Step. As of now, there is no indication of which dataset you are talking about and for which Mission.
  2. Try to apply the appropriate tags to the question if possible.
  3. Share your code, in text form and properly formatted.
    3.1 If the code varies between the platform and your local use-case, then share both.
  4. You can always check the documentation for the pandas version to see if there are indeed any differences or not.

You can also refer to Introducing guidelines for all technical questions in our Community and Guide: How to Ask a Good Question as well.

1 Like

Apologies for this. I thought posting it from the mission’s community link would categorize it.

  1. https://app.dataquest.io/m/152/conditional-plots/2/introduction-to-the-data-set
  2. I did apply some tags but I’m not sure which ones you mean. Apologies again!

import pandas as pd
titanic = pd.read_csv(‘train.csv’)
titanic = titanic[[‘Survived’,‘Pclass’,‘Sex’,‘Age’,‘SibSp’,‘Parch’,‘Fare’,‘Embarked’]]
titanic.dropna(inplace=True)
4. I think I am missing something in this issue, I’ll double check the documentation.

Thank you for your support. It’s my first post :slight_smile:

No worries.

I tried your code on my own system with Pandas version 0.25 and 1.1. I got the same result as the one on the Dataquest platform - 712 rows.

This could only really be something related to the dataset you downloaded and/or if you accidentally made any changes to it. I don’t see what else could be the problem.

1 Like

I tried it again and it seems fine. Not sure where my mistake was. Thank you for the support :slight_smile:

1 Like