Adding two pandas dataframes
Both the above answers - fillna(0) and a direct addition would give you Nan values if either of them have different structures.
Its Better to use fill_value
df.add(other_df, fill_value=0)
I have two dataframes, both indexed by timeseries.  I need to add the elements together to form a new dataframe, but only if the index and column are the same.  If the item does not exist in one of the dataframes then it should be treated as a zero.
I've tried using .add but this sums regardless of index and column.  Also tried a simple combined_data = dataframe1 + dataframe2 but this give a NaN if both dataframes don't have the element.
Any suggestions?