No Usageband

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!

1 Like

Sorry found my mistake!

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

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

Alright :grinning:

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

Did u find a solution ?

@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.

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