python – pandas fillna not working

python – pandas fillna not working

You need inplace=True

df[1].fillna(0, inplace=True)

You need to assign the value df = df.fillna( t )

python – pandas fillna not working

Alternativly:

df = df.replace(np.nan, 0) #or any other value you deem fit

df.replace(np.nan, 0) or df.fillna(0) threw me off when I applied certain str.replace()-operations right after Na-operations.. so watch out for your order of commands -> first str.replace() than fillna()

Leave a Reply

Your email address will not be published.