BUG: frame.isetitem
incorrectly casts Int64
columns to dtype object
#49922
Labels
Bug
Indexing
Related to indexing on series/frames, not to indexes themselves
NA - MaskedArrays
Related to pd.NA and nullable extension arrays
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
After trying to follow the instructions in the
FutureWarning
referenced in the code above, I got into trouble with nullable integer columns ending up asdtype=object
.The warning in question:
Expected Behavior
I would expect that
frame.isetitem(cols, ...)
would not castInt64
columns toobject
, but rather work exactly similar to howframe.iloc[:, cols] = ...
works.Installed Versions
INSTALLED VERSIONS
commit : 8dab54d
python : 3.8.13.final.0
python-bits : 64
OS : Darwin
OS-release : 22.1.0
Version : Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8
pandas : 1.5.2
numpy : 1.23.2
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 65.4.1
pip : 22.3.1
Cython : 0.29.32
pytest : 6.2.5
hypothesis : None
sphinx : 5.1.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.4.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.5.3
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: