1、两个序列(Serise)相加:s1+s2
import pandas as pd
import numpy as np
# 两个序列相加,没有交叠的标签,相加会返回NaN
s1 = pd.Series([7.3, -2.5, 3.4, 1.5], index=['a', 'c', 'd', 'e'])
s2 = pd.Series([-2.1, 3.6, -1.5, 4, 3.1],index=['a', 'c', 'e', 'f', 'g'])
s1+s2
"""
a 5.2
c 1.1
d NaN
e 0.0
f NaN
g NaN
dtype: float64
"""
2、两个矩阵(DataFrame)相加:df1+df2
# 两个矩阵相加,没有交叠的标签,相加也会返回NaN
df1 = pd.DataFrame(np.arange(9.).reshape((3, 3)), columns=list('bcd'),
index=['Ohio', 'Texas', 'Colorado'])
df2 = pd.DataFrame(np.arange(12.).reshape((4, 3)), columns=list('bde'),
index=