I have a Pandas Dataframe as below:
itm Date Amount 67 420 2012-09-30 00:00:00 65211 68 421 2012-09-09 00:00:00 29424 69
If you were to convert it to a pandas dataframe, you can also accomplish this by using fillna.
fillna
import numpy as np df=np.array([[1,2,3, np.nan]]) import pandas as pd df=pd.DataFrame(df) df.fillna(0)
This will return the following:
0 1 2 3 0 1.0 2.0 3.0 NaN >>> df.fillna(0) 0 1 2 3 0 1.0 2.0 3.0 0.0