pandas 0 for nan code example
Example 1: python pandas convert nan to 0
pandas.DataFrame.fillna(0)
Example 2: pandas where retuning NaN
# Try using a loc instead of a where:
df_sub = df.loc[df.yourcolumn == 'yourvalue']
pandas.DataFrame.fillna(0)
# Try using a loc instead of a where:
df_sub = df.loc[df.yourcolumn == 'yourvalue']