python - Pandas: replace empty cell to 0 when write to file -
i have df , there empty cells. want write excel , need print there 0 instead empty. try result.fillna(0) , result.replace(r'\s+', np.nan, regex=true) doesn't help.
you creating copy of dataframe original 1 not keeping changes, need specify "inplace=true" if want dataframe persist changes
result.fillna(0, inplace=true)
Comments
Post a Comment