GroupBy aggregation fails if DataFrame has CategoricalIndex #31223
Labels
ExtensionArray
Extending pandas with custom dtypes or arrays.
Groupby
Regression
Functionality that used to work in a prior pandas version
Milestone
Code Sample, a copy-pastable example if possible
Problem description
The above works in v.
0.25.3
but not in1.0.0rc0
. It fails with:TypeError: Cannot convert Categorical to numpy.ndarray
Full stack trace:
Expected Output
The correct result applying the aggregation function to the DataFrameGroupBy
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.6.9.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.0rc0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.1
setuptools : 45.1.0
Cython : None
pytest : 5.2.0
hypothesis : None
sphinx : 2.0.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.2.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : 0.3.2
gcsfs : None
lxml.etree : None
matplotlib : 3.0.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 5.2.0
s3fs : 0.4.0
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : 0.47.0
The text was updated successfully, but these errors were encountered: