To replace the NaN(missing value) by scalar value using python.
Import pandas library.
Read the sample data.
Make it as a data frame.
Use fillna() to replace Nan value.
#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())
#Replace the missing values(Nan)
print(“Replace the Nan values”)
print(df.fillna(0))