Closed
Description
Location of the documentation
Documentation problem
The documentation declares that the downcast
argument of pd.to_numeric
can use the value int
. However, only integer
is working in the real code:
In [8]: pd.to_numeric(["42"], downcast="int", errors="coerce")
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-3b178e77dcd5> in <module>
----> 1 pd.to_numeric(["42"], downcast="int", errors="coerce")
/usr/lib/python3.8/site-packages/pandas/core/tools/numeric.py in to_numeric(arg, errors, downcast)
110 """
111 if downcast not in (None, "integer", "signed", "unsigned", "float"):
--> 112 raise ValueError("invalid downcasting method provided")
113
114 if errors not in ("ignore", "raise", "coerce"):
ValueError: invalid downcasting method provided
In [9]: pd.to_numeric(["42"], downcast="integer", errors="coerce")
Out[9]: array([42], dtype=int8)
Suggested fix for documentation
Replace int
with integer