clean nas from column pandas

>>> df.dropna()
     name        toy       born
1  Batman  Batmobile 1940-04-25

Here is what the above code is Doing:
1. We create a DataFrame with some NA values in it.
2. We drop the rows that contain those NA values.
3. We print out the result.

Note that the .dropna() method doesn’t actually modify your DataFrame. It just returns a new DataFrame with the rows removed.

If you want to remove the rows in place, you have to tell the .dropna() method to do that.

You do that by setting the keyword inplace=True like this:


This modifies the DataFrame in place and returns nothing.


Print out the .shape attribute of the cars DataFrame.


Drop all the rows that contain missing values and assign the result to cars.


Print out the .shape attribute of the cars DataFrame to see how many rows it now has.