To find missing values in a data sample and drop those missing values in python.
Import pandas library, because the data pre processing is mostly done by using pandas function.
Read the sample data.
Make it as a data frame.
Find the missing value and drop those samples using pandas inbuilt functions,df.isnull() and df.dropna().
Whenever we using isnull(),it finds missing values in the data set.
Whenever we using dropna(),it drop entire sample in a data set.
#import libraries
import pandas as pd
#Read the sample data
data=pd.read_csv(‘/home/soft27/soft27
/Sathish/Pythonfiles/Houseprice.csv’)
#create data frame
df=pd.DataFrame(data)
print(“Actual data frame is:\n”,df)
#Find the missing values
print(“Find missing values”)
print(df.isnull())
#Drop the missing values(Nan)
print(“Drop missing values”)
print(df.dropna())