No Usageband


(Kashish Mukheja) #1

On running the code :-

df_raw.UsageBand.cat.set_categories([‘High’, ‘Medium’, ‘Low’], ordered=True, inplace=True)

AttributeError Traceback (most recent call last)
in ()
----> 1 df_raw.UsageBand.cat.set_categories([‘High’, ‘Medium’, ‘Low’], ordered=True, inplace=True)

/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py in getattr(self, name)
3612 if name in self._info_axis:
3613 return self[name]
-> 3614 return object.getattribute(self, name)
3615
3616 def setattr(self, name, value):

AttributeError: 'DataFrame’ object has no attribute 'UsageBand’

Pls Help!


(Kashish Mukheja) #2

Sorry found my mistake!


(LOREN T HOPKINS) #3

What was the mistake please. I’m having the same problem


(LOREN T HOPKINS) #4

Don’t worry. Figured it out. Cheers :grinning:


(Kashish Mukheja) #5

Alright :grinning:


#6

@kashish18 Hey, I am also getting the similar error can you point me towards a mistake.


(abc) #7

Did u find a solution ?


#8

@berlinwar Hey, UsageBand is a feature/column in Bulldozers data set only.

Jeremy in this code is just taking an example of UsageBand feature to show how to check different categories in the categorical variable and how to arrange them in a particular order which makes more sense.
I hope this helps.


(abc) #9

Took me time, but I found this as well, and it does definitely help. Thanks :slight_smile: