How to Handle Missing Data fillna and dropna in Pandas

Free Pandas course with real-time projects Start Now!!

program 1

import pandas as pd
df=pd.read_excel("E://mypandas/employee.xlsx")
# df=df.fillna(0)
# print(df)
# print("Before Drop")
# print(df)
# df=df.dropna()
# print("After Drop")
# print("--------------------------------")
# print(df)
print(df[['empname','HRA']].fillna(0))

 

Did you like this article? If Yes, please give DataFlair 5 Stars on Google

follow dataflair on YouTube

1 Response

  1. Sikiru Yusuff says:

    Very interesting, thanks for providing this invaluable lesson.

Leave a Reply

Your email address will not be published. Required fields are marked *