Python Forum
Not able to use Cut function in python DAND
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not able to use Cut function in python DAND
#1
Hi I am trying to group ages in titanic data set using CUT function in pandas dataframe. But it is showing error. I have update the pandas. currently it is pandas .20.3. please find the snapshot below.

data["age_grp"] = data.cut(data["Age"], 3, retbins=True)
Error:
[b]Error: [/b] AttributeError Traceback (most recent call last) <ipython-input-15-2f34dc62e7bf> in <module>() ----> 1 data["age_grp"] = data.cut(data["Age"], 3, retbins=True) C:\Users\prateek\Anaconda2\lib\site-packages\pandas\core\generic.pyc in __getattr__(self, name) 3079 if name in self._info_axis: 3080 return self[name] -> 3081 return object.__getattribute__(self, name) 3082 3083 def __setattr__(self, name, value): AttributeError: 'DataFrame' object has no attribute 'cut'
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020