Currently the groupby raises a warning by pandas as the default behavior will change
From pandas documentation:
observed : bool, default False
This only applies if any of the groupers are Categoricals. If True: only show observed values for categorical groupers. If False: show all values for categorical groupers.
Deprecated since version 2.1.0: The default value will change to True in a future version of pandas.
To retain the old behavior we need to set observed=False which also fixes the warning
Currently the groupby raises a warning by pandas as the default behavior will change
From pandas documentation:
To retain the old behavior we need to set
observed=False
which also fixes the warning