插值
import pandas as pd
import numpy as np
df = pd.DataFrame({'A':[1,2,np.nan,3,np.nan],
'B':[1.2,7,3,0,8]})
df['C'] = df.A.interpolate()
df['D'] = df.A.interpolate(method='spline', order=1)
print (df)
A B C D
0 1.0 1.2 1.0 1.000000
1 2.0 7.0 2.0 2.000000
2 NaN 3.0 2.5 2.428571
3 3.0 0.0 3.0 3.000000
4 NaN 8.0 3.0 3.714286