BUG: df.iloc[:, x] = df.iloc[:, x].apply(int) will failed just and only when int
in apply()
#56796
Open
3 tasks done
Labels
Bug
Closing Candidate
May be closeable, needs more eyeballs
Dtype Conversions
Unexpected or buggy dtype conversions
Indexing
Related to indexing on series/frames, not to indexes themselves
Needs Triage
Issue that has not been reviewed by a pandas team member
PDEP6-related
related to PDEP6 (not upcasting during setitem-like Series operations)
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
FYI:
df.iloc[:, 0] = df.iloc[:, 0].astype(int)
failed too.I tried pandas below pandas2.0, such as pandas 1.4.1 it worked expectly.
and during my tests, I found only the first time i put
int
orlambda x: int(x)
in.apply()
not working. other function will work properly.Expected Behavior
Installed Versions
INSTALLED VERSIONS
commit : a671b5a
python : 3.11.5.final.0
python-bits : 64
OS : Darwin
OS-release : 21.6.0
Version : Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8101
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : None
LOCALE : zh_CN.UTF-8
pandas : 2.1.4
numpy : 1.24.4
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 68.1.2
pip : 23.3.1
Cython : 3.0.0a10
pytest : 7.4.3
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader : None
bs4 : None
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.4.3
numba : 0.57.0
numexpr : None
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.4
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: