Description
From discussion below: pd.to_numeric
does not validate the value passed to the errors
keyword, so any random value is interpreted as errors='coerce'
.
Original report:
Code Sample, a copy-pastable example if possible
df = pd.DataFrame({'Strings': ['fire', 'hose'], 'Numbers': ['3838.2', '99']})
print(df.apply(pd.to_numeric, args={'errors': 'ignore'}).to_string())
Problem description
The code above should return:
Strings Numbers
0 'fire' 3838.2
1 'hose' 99.0
Instead it returns:
Strings Numbers
0 NaN 3838.2
1 NaN 99.0
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.0-48-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.2
pytest: 4.4.1
pip: 19.1
setuptools: 41.0.0
Cython: 0.29.7
numpy: 1.16.3
scipy: 1.2.1
pyarrow: 0.10.0
xarray: 0.12.1
IPython: 7.5.0
sphinx: None
patsy: 0.5.1
dateutil: 2.8.0
pytz: 2019.1
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: 0.4.0
matplotlib: 3.0.3
openpyxl: None
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.7
lxml.etree: 4.3.3
bs4: 4.6.3
html5lib: 0.9999999
sqlalchemy: 1.3.3
pymysql: None
psycopg2: 2.7.5 (dt dec pq3 ext lo64)
jinja2: 2.10.1
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None