Hi guys is am getting this error:
'Index' object has no attribute 'labels'
The traceback looks like this:
Traceback (most recent call last):
File "<ipython-input-23-e0f428cee427>", line 1, in <module>
df_top_f = k.groupby(['features'])['features'].count().unstack('features')
File "C:\Anaconda3\lib\site-packages\pandas\core\series.py", line 2061, in unstack
return unstack(self, level, fill_value)
File "C:\Anaconda3\lib\site-packages\pandas\core\reshape.py", line 405, in unstack
fill_value=fill_value)
File "C:\Anaconda3\lib\site-packages\pandas\core\reshape.py", line 90, in __init__
self.lift = 1 if -1 in self.index.labels[self.level] else 0
AttributeError: 'Index' object has no attribute 'labels'
While running the following code
df_top_f = df.groupby(['features'])['features'].count().unstack('features')
df has the following structure:
features
Ind
0 Doorman
1 Cats Allowed
2 Doorman
3 Cats Allowed
4 Dogs Allowed
5 Doorman
df.index looks like this:
RangeIndex(start=0, stop=267906, step=1, name='Ind')
Looks very straight forward but I can't understand why I am getting this error. Please help