Reputation: 31
I am trying to do a simple replace with pandas:
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'
What am I missing?
Upvotes: 3
Views: 1931
Reputation: 375415
The replace
method was added in version 0.9.0 (see release notes).
Note: You can inspect the docs for a specific version of pandas by selecting that version on the right-hand-side of the webpage. But do consider updating to the latest stable version.
Upvotes: 3