pandas DataFrame add fill_value NotImplementedError
The stack trace indicates that this parameter was never implemented:
.../pandas/core/frame.py in _combine_match_columns(self, other, func, level, fill_value)
3470 if fill_value is not None:
3471 raise NotImplementedError("fill_value %r not supported" %
-> 3472 fill_value)
3473
I could just fill the missing values before addition:
In [43]: df.fillna(0).add(s)
Out[43]:
0 1 2 3 4
0 1 1 2 3 4
1 2 3 2 4 4
2 1 1 3 4 4
3 1 1 2 4 6
4 1 3 4 3 5
I ran into this issue also. In my case it's because I was adding a series to a dataframe.
The fill_value=0
instruction works for me when adding a series to a series or adding a dataframe to a dataframe.
I just made a new dataframe with the series as its only column and now I can add them with fill_value=0
.
df1.add(df2, fill_value=0) # This works
series1.add(series2, fill_value=0) # This works
df.add(series, fill_value=0) # Throws error
df.add(pd.DataFrame(series), fill_value=0) # Works again