我有一个包含NaN值的数据框:
>>>df.head()
Out[1]:
JPM US SMALLER COMPANIES C ACC
1990-01-02 NaN
1990-01-03 NaN
1990-01-04 NaN
1990-01-05 NaN
1990-01-08 NaN
我有另一个包含数值的数据框:
>>>t.head()
Out[1]:
1990-01-02 51.95
1990-01-03 52.63
1990-01-04 53.04
1990-01-05 52.07
1990-01-08 51.73
Name: JPM US SMALLER COMPANIES C ACC, dtype: float64
很遗憾,df.fillna对我来说似乎不起作用:
>>>df.fillna( t ).head()
Out[1]:
JPM US SMALLER COMPANIES C ACC
1990-01-02 NaN
1990-01-03 NaN
1990-01-04 NaN
1990-01-05 NaN
1990-01-08 NaN
[5 rows x 1 columns]
为什么会发生这种情况?我使用的是pandas 0.13.1版本。