In the context of this exercise, can we set another value to take place of missing values instead of None or nan?
Answer
After performing an outer merge, missing values will become filled with None or nan by default, and there is no way to set another value during this step.
After the merge, replacing these is a bit easier. You can utilize the fillna() method, which will replace all missing or nan values with another value you specify.
# Replaces all nan values with 0
df.fillna(0, inplace=True)
What If I want to fill the nan with different values in the table?
For example, I want to fill the first row nan with 6 and the second row nan with 5…
How do I accomplish that?
Thanks
Similar question but can we also replace ‘nan’ with different values for different rows? for example row 1 and 3 on the outer table I want to replace ‘nan’ with 2 different values?