Reputation: 43
I had applied df.fillna(0)
to Datafarm df
read from CSV
file to fillout NaN
with 0 but it not works
here is my code for reading and apply fillna
method.
I have checked here on Pandas website and all was same. Also some similar question on Stackoverflow like this and this. all checked not helped
import pandas as pd
df=pd.read_csv(path to CSV file, header=None)
df.fillna(0)
print(df)
Upvotes: 1
Views: 470
Reputation: 1089
Try this:
only change df.fillna(0, inplace = True)
import pandas as pd
df=pd.read_csv(path to CSV file, header=None)
df.fillna(0, inplace = True)
print(df)
Upvotes: 3