Articles → Pandas → Fillna Function In Pandas

Fillna Function In Pandas






Purpose





Example


import numpy as np
import pandas as pd

# Create a list
list = [[1,2,3], [4,np.nan,6], [7, np.nan, np.nan]]

df = pd.DataFrame(list)

print("Initial\n", df)

df = df.fillna("FILL VALUE")

print("\nAfter \n", df)



Output


Picture showing the output of the fillna function in pandas
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, April 30, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250