我正在尝试用熊猫做一个简单的替换:
from pandas import *
In [2]: df = DataFrame({1: [2,3,4], 2: [3,4,5]})
In [4]: df[2]
Out[4]:
0 3
1 4
2 5
Name: 2
In [5]: df[2].replace(4, 17)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
c:\Python27\<ipython-input-5-b4adce9e9b15> in <module>()
----> 1 df[2].replace(4, 17)
AttributeError: 'Series' object has no attribute 'replace'
我错过了什么?