I am trying to use the pandas "cut" method, but am getting an object has no attribute
error. I've imported pandas and it works for other commands. Is this a known issue or am I missing something? I restarted Python thinking this might just be a random bug but it doesn't seem to be...
Full error below:
python 2.7.3 (default, Sep 26 2013, 20:08:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> day1 = pd.read_csv('nyt1.csv') #<-- THIS WORKS
>>> pd.cut(day1.Age,[18,24,34,44,54,64,],right=False)[:30] #<-- THIS DOES NOT?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'cut'
>>> pd
<module 'pandas' from '/usr/lib/pymodules/python2.7/pandas/__init__.pyc'>
>>> pd.__version__
'0.7.0'
EDIT: Included the version of pandas.
The cut
function was introduced in pandas v0.8.0. Update to a newer version and your code should work!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments