How do I replace NaN values using group by pivot_table in pandas DataFrame?
Consider using df.fillna(). That has a  variety of options to replace nans with values of choices. You can apply it on either the complete data frame or on specific columns (I.e Series).