Extension dtypes are modified when performing groupby aggregate with agg dict #32194
Labels
Groupby
NA - MaskedArrays
Related to pd.NA and nullable extension arrays
Regression
Functionality that used to work in a prior pandas version
Milestone
Code Sample, a copy-pastable example if possible
Problem description
When using Extension dtypes, StringDtype, BooleanDtype, Int64Dtype, Int32Dtype, etc., in a DataFrame, the dtypes are modified to float64 when performing a
groupby.agg
with a dict defining the reducing function per column. This change in dtypes doesn't occur with numpy dtypes, and it doesn't occur when using a single agg func as scalar instead of the dict.Expected Output
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit : None
python : 3.6.7.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.1
numpy : 1.14.0
pytz : 2018.7
dateutil : 2.7.5
pip : 18.1
setuptools : 40.6.2
Cython : 0.29.1
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10
IPython : 7.3.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : 0.3.3
gcsfs : None
lxml.etree : None
matplotlib : 3.0.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : 0.1.3
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : 0.36.2
The text was updated successfully, but these errors were encountered: