-  
-   Notifications  You must be signed in to change notification settings 
- Fork 19.2k
Description
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
import pandas as pd import pyarrow as pa print(pd.__version__) print(pa.__version__) df = pd.DataFrame({ 'a': [-9223372036854775808, 4611686018427387904, 9223372036854775807, None], 'b': [-9223372036854775808, 4611686018427387904, 9223372036854775807, None], 'c': [-9223372036854775808, 4611686018427387904, 9223372036854775807, None], }) pa_df = df.convert_dtypes(dtype_backend='pyarrow') print(pa_df)2.2.2 16.0.0 /Users/User/.pyenv/versions/3.12.1/lib/python3.12/site-packages/pandas/core/dtypes/cast.py:1057: RuntimeWarning: invalid value encountered in cast if (arr.astype(int) == arr).all(): /Users/User/.pyenv/versions/3.12.1/lib/python3.12/site-packages/pandas/core/dtypes/cast.py:1081: RuntimeWarning: invalid value encountered in cast if (arr.astype(int) == arr).all(): a b c 0 -9223372036854775808 -9223372036854775808 -9223372036854775808 1 4611686018427387904 4611686018427387904 4611686018427387904 2 9223372036854775807 9223372036854775807 9223372036854775807 3 <NA> <NA> <NA> Issue Description
Throwing a warning when converting
Expected Behavior
It should not throw a warning, it looks like the conversion happens successfully in spite of the warning.
Installed Versions
pandas : 2.2.2
 numpy : 1.26.4
 pytz : 2024.1
 dateutil : 2.8.2
 setuptools : 69.5.1
 pip : 23.2.1
 Cython : None
 pytest : 8.1.1
 hypothesis : None
 sphinx : None
 blosc : None
 feather : None
 xlsxwriter : None
 lxml.etree : None
 html5lib : None
 pymysql : None
 psycopg2 : None
 jinja2 : 3.1.3
 IPython : None
 pandas_datareader : None
 adbc-driver-postgresql: None
 adbc-driver-sqlite : None
 bs4 : None
 bottleneck : None
 dataframe-api-compat : None
 fastparquet : None
 fsspec : 2024.3.1
 gcsfs : None
 matplotlib : None
 numba : None
 numexpr : None
 odfpy : None
 openpyxl : None
 pandas_gbq : None
 pyarrow : 16.0.0
 pyreadstat : None
 python-calamine : None
 pyxlsb : None
 s3fs : None
 scipy : None
 sqlalchemy : 2.0.29
 tables : None
 tabulate : None
 xarray : None
 xlrd : None
 zstandard : None
 tzdata : 2024.1
 qtpy : None
 pyqt5 : None