BUG: TypeError: Int64 when using pd.pivot_table
with Int64
values
#47477
Labels
Bug
NA - MaskedArrays
Related to pd.NA and nullable extension arrays
Regression
Functionality that used to work in a prior pandas version
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
This aggregation raises a
TypeError: Int64
However, it you change age to
int64
the code works. Also note that it works if you perform the same operation via.groupby
/.unstack
:ie:
This also works:
Expected Behavior
I expect to see the following result:
Installed Versions
INSTALLED VERSIONS
commit : 4bfe3d0
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.16.3-microsoft-standard-WSL2
Version : #1 SMP Fri Apr 2 22:23:49 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.2
numpy : 1.19.4
pytz : 2022.1
dateutil : 2.8.1
pip : 20.0.2
setuptools : 44.0.0
Cython : 0.29.24
pytest : 7.1.1
hypothesis : 6.8.1
sphinx : 4.3.2
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.6.2
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.0.3
IPython : 7.19.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : None
brotli : None
fastparquet : None
fsspec : 2021.07.0
gcsfs : None
markupsafe : 2.1.1
matplotlib : 3.3.3
numba : 0.52.0
numexpr : 2.8.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : 8.0.0
pyreadstat : 1.1.4
pyxlsb : None
s3fs : None
scipy : 1.5.4
snappy : None
sqlalchemy : 1.4.27
tables : None
tabulate : 0.8.9
xarray : 0.18.2
xlrd : 2.0.1
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: