In pandas, missing or null values are represented by NaN. To fill in missing data with NaN in python using pandas, you can use the fillna method.
main.py322 chars12 lines
In the above example code, the fillna()
function takes an argument value
, which is set to pd.np.nan
to fill in missing values with NaN. The inplace
parameter is used to modify the dataframe in place i.e it returns None and modifies the original dataframe by setting the missing data as NaN.
gistlibby LogSnag