Pandas version checks
- [x] I have checked that the issue still exists on the latest versions of the docs on
main
here
Location of the documentation
https://pandas.pydata.org/docs/dev/reference/api/pandas.to_numeric.html#pandas-to-numeric
Documentation problem
The docstring for the to_numeric
function needs to be improved for clarity and accuracy. The current documentation states, "The default return dtype is float64 or int64," which can be misleading. This statement doesn't account for cases where the input data is already of a numeric ExtensionDtype (e.g., Int32, Float32, or Arrow dtypes where _is_numeric
is True
). In these instances, to_numeric
correctly preserves the original dtype rather than converting it, making the current documentation incomplete.
Suggested fix for documentation
- If the input is already of a numeric dtype, its dtype is preserved.
- The conversion to a default float64 or int64 dtype primarily applies to non-numeric inputs.
Comment From: chilin0525
Related to https://github.com/pandas-dev/pandas/issues/61641#issuecomment-3013740740
Comment From: chilin0525
take