'ERROR: 'GroupedData' object is not subscriptable? In python Databricks
basket = (Removals[Removals['FLEET'] =="F"]
.groupby('ID', 'DESCRIPTION')['REMOVAL_COUNT']
.sum().unstack().reset_index().fillna(0)
.set_index('ID'))
This is my code and I keep getting this error:
TypeError: 'GroupedData' object is not subscriptable --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in ----> 1 basket = (Removals[Removals['FLEET'] =="F"] 2 .groupby('ID', 'DESCRIPTION')['REMOVAL_COUNT'] 3 .sum().unstack().reset_index().fillna(0) 4 .set_index('ID'))
TypeError: 'GroupedData' object is not subscriptable
Is the issue in my syntax? I can't seem to find the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
