Pandas version checks

  • [x] I have checked that this issue has not already been reported.

  • [x] 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

from pandas.api.types import infer_dtype
assert infer_dtype(pd.Series([1.,2.,.3,pd.NA], dtype=object)) ==  infer_dtype(pd.Series([1.,2.,.3,np.nan], dtype=object))

Issue Description

Dear pandas-folks,

This was checked for pandas V 2.3.0 and 2.2.X

When using pandas' infer_dtype on an object array consisting out of floats with embedded pd.NA, the result will be mixed-integer-float tough skipna is True as a default.

The same test for embedded np.nan returns floating.

    >>> from pandas.api.types import infer_dtype
    >>> infer_dtype(pd.Series([1,2,3,pd.NA], dtype=object))
    'integer'
    >>> infer_dtype(pd.Series([1,2,3,np.nan], dtype=object))
    'integer'
    >>> infer_dtype(pd.Series([1.,2.,.3,pd.NA], dtype=object))
    'mixed-integer-float' v <<< should be `floating`
    >>> infer_dtype(pd.Series([1.,2.,.3,np.nan], dtype=object))
    'floating'
    >>> infer_dtype(pd.Series(['1.0', np.nan],dtype=object))
    'string'
    >>> infer_dtype(pd.Series(['1.0', pd.NA],dtype=object))
    'string'

In case of other types, like integer or strings, the function does not produce a false / different output w.r.t. the na-type.

Context, I am maintaining a small project which assures integers in columns to stay integers - a common known issue. I you know of a well established extension for this purpose, feel free to point me towards it.

Expected Behavior

>>> infer_dtype(pd.Series([1.,2.,.3,pd.NA], dtype=object)) should return floating

Installed Versions

INSTALLED VERSIONS ------------------ commit : 2cc37625532045f4ac55b27176454bbbc9baf213 python : 3.13.3 python-bits : 64 OS : Linux OS-release : 4.18.0-553.51.1.el8_10.x86_64 Version : #1 SMP Fri Apr 25 00:55:37 EDT 2025 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.3.0 numpy : 2.2.6 pytz : 2025.2 dateutil : 2.9.0.post0 pip : 25.1.1 Cython : None sphinx : None IPython : 9.2.0 adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None blosc : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None html5lib : None hypothesis : None gcsfs : None jinja2 : None lxml.etree : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None psycopg2 : None pymysql : None pyarrow : 20.0.0 pyreadstat : None pytest : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : 0.9.0 xarray : None xlrd : None xlsxwriter : None zstandard : None tzdata : 2025.2 qtpy : None pyqt5 : None

Comment From: arthurlw

Confirmed on main! Investigations and PRs are welcome.

Thanks for raising this!

Comment From: heoh

I want to contribute to this. Thank you for explaining the issue.

Comment From: heoh

take

Comment From: MarkusZimmerDLR

Since this seems to be a very simple and minor fix, is it possible to not wait for the 3.0 release? Or is the release imminent?