Skip to content

BUG: default value for dtype_backend is not applied by default #58938

Closed
@pumpkinlink

Description

@pumpkinlink

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

python
# (interactive shell)
import pandas
s = pandas.Series(['150', pandas.NA])
print(pandas.to_numeric(s))
# 0    150.0
# 1      NaN
# dtype: float64
print(pandas.to_numeric(s, dtype_backend='numpy_nullable'))
# 0     150
# 1    <NA>
# dtype: Int64


### Issue Description

Documentation says that `numpy_nullable` is the default value for the `dtype_backend` argument, 
yet the funcion works differently whether you pass it explicitly or not.

### Expected Behavior

``` python
# (interactive shell)
import pandas
s = pandas.Series(['150', pandas.NA])
print(pandas.to_numeric(s))
# 0     150
# 1    <NA>
# dtype: Int64

Installed Versions

/home/denisfranco/.local/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")

INSTALLED VERSIONS
------------------
commit                : d9cdd2ee5a58015ef6f4d15c7226110c9aab8140
python                : 3.10.12.final.0
python-bits           : 64
OS                    : Linux
OS-release            : 6.5.0-35-generic
Version               : #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May  7 09:00:52 UTC 2
machine               : x86_64
processor             : x86_64
byteorder             : little
LC_ALL                : None
LANG                  : en_US.UTF-8
LOCALE                : pt_BR.UTF-8

pandas                : 2.2.2
numpy                 : 1.22.4
pytz                  : 2022.1
dateutil              : 2.8.2
setuptools            : 65.6.3
pip                   : 22.0.2
Cython                : None
pytest                : None
hypothesis            : None
sphinx                : None
blosc                 : None
feather               : None
xlsxwriter            : None
lxml.etree            : 4.8.0
html5lib              : 1.1
pymysql               : None
psycopg2              : None
jinja2                : 3.1.2
IPython               : 8.4.0
pandas_datareader     : None
adbc-driver-postgresql: None
adbc-driver-sqlite    : None
bs4                   : None
bottleneck            : None
dataframe-api-compat  : None
fastparquet           : None
fsspec                : None
gcsfs                 : None
matplotlib            : None
numba                 : None
numexpr               : None
odfpy                 : None
openpyxl              : 3.1.2
pandas_gbq            : None
pyarrow               : None
pyreadstat            : None
python-calamine       : None
pyxlsb                : None
s3fs                  : None
scipy                 : None
sqlalchemy            : None
tables                : None
tabulate              : None
xarray                : None
xlrd                  : None
zstandard             : None
tzdata                : 2024.1
qtpy                  : None
pyqt5                 : None

Metadata

Metadata

Assignees

Labels

DocsDtype ConversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions