How can we treat missing datas in pandas dataframe through deletion in python?

python

#1

hey,
I have read in an article that one of the ways to handle missing data in a pandas dataframe is to delete the whole row or to go for pairwise deletion.I only how to drop the columns in a dataframe not the rows. How can we delete the rows. And I Could not understand what is pair-wise deletion in python for dataframes having missing values ?
Thanks


#2

@Steve,

Deletion is one of the method of treating missing data values.Deletion of missing values can be done in two ways:

  • List Wise Deletion: Delete observations where any of the variable is missing
  • Pair Wise Deletion: Include all cases in data analysis in which the variables of interest are present

To delete entire rows, you can use below python code
df = df[df.Manpower.notnull()]

Regards,
Sunil