pandas replace nan with values from another dataframe code example
Example 1: replace "-" for nan in dataframe
df.replace(np.nan,0)
Example 2: replace all nan values in dataframe
# Replacing all nan values with 0 in Dataframe
df = df.fillna(0)
Example 3: pandas if nan, then the row above
df.fillna(method='ffill')