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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With