Q:

NaN values when adding two columns

I have two dataframes with different indexing that I want to sum the same column from the two dataframes. 
I tried the following but gives NaN values
result['Anomaly'] = df['Anomaly'] + tmp['Anomaly']

df
    date           Anomaly
0 2018-12-06         0
1 2019-01-07         0
2 2019-02-06         1
3 2019-03-06         0
4 2019-04-06         0

tmp
    date           Anomaly
0 2018-12-06         0
1 2019-01-07         1
4 2019-04-06         0

result
    date           Anomaly
0 2018-12-06        0.0
1 2019-01-07        NaN
2 2019-02-06        1.0
3 2019-03-06        0.0
4 2019-04-06        0.0

What I want is actually:
result
    date           Anomaly
0 2018-12-06         0
1 2019-01-07         1
2 2019-02-06         1
3 2019-03-06         0
4 2019-04-06         0

A:

Here is necessary align by datetimes, so first use DataFrame.set_index for DatetimeIndex and then use Series.add:
df = df.set_index('date')
tmp = tmp.set_index('date')
result = df['Anomaly'].add(tmp['Anomaly'], fill_value=0).reset_index()

A:

You can try this
pd.concat([df, tmp]).groupby('date', as_index=False)["Anomaly"].sum()

         date  Anomaly
0  2018-12-06        0
1  2019-01-07        1
2  2019-02-06        1
3  2019-03-06        0
4  2019-04-06        0

