Identify all feature having missing value in Pandas Dataframe

missing_values
python

#1

Hi,

I am working on a data science challenge and it has more than 100 features. I have identified the numerical and categorical features. Now, I want to find the features having missing values and post that want to impute all numerical feature with mean. This will help me to automate my repetitive task of missing value imputation while working on a data science challenge.

Thanks,
Imran


#2

@Imran- you can use isnull or notnull function for finding the missing value in Python

for example 
In [25]: obj4
Out[25]:
California NaN
Ohio 35000
Oregon 16000
Texas 71000

In [26]: pd.isnull(obj4) 
Out[26]: 
California True
Ohio False 
Oregon False
Texas False

Hope this helps!

Regards,
Hinduja


#3

@Imran,

Command suggested by @hinduja1234 will return the data frame with True or False against each value for each feature. It will return True when it has missing value else False.

I believe you want command to show the list of columns have missing value or not. Below command will help you to perform same.

Data.isnull().any() #Data is the name of dataframe

Regards,
Sunil