Skip to content

DOC: downcast argument for pd.to_numeric should be integer, not int #35760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
languitar opened this issue Aug 17, 2020 · 3 comments · Fixed by #35776
Closed

DOC: downcast argument for pd.to_numeric should be integer, not int #35760

languitar opened this issue Aug 17, 2020 · 3 comments · Fixed by #35776

Comments

@languitar
Copy link

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.to_numeric.html?highlight=to_numeric#pandas.to_numeric

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

@languitar languitar added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 17, 2020
@simonjayhawkins
Copy link
Member

Thanks @languitar for the report.

It appears that the docs were incorrectly updated in #33093 (and that there are other docstrings that may also now be incorrect)

further investigation and PRs welcome

@simonjayhawkins simonjayhawkins added good first issue and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 17, 2020
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Aug 17, 2020
@simonjayhawkins simonjayhawkins modified the milestones: Contributions Welcome, 1.1.1 Aug 18, 2020
@Anupam-USP
Copy link
Contributor

I am new to contribution, I wanted to know if this issue is still open to work on?

@simonjayhawkins
Copy link
Member

Thanks @Anupam-USP.

I wanted to know if this issue is still open to work on?

There is currently a PR open to address this issue. #35776

I am new to contribution

you may want to look through the good first issues that need tests added to prevent regressions

https://github.com/pandas-dev/pandas/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+label%3A%22Needs+Tests%22

or for documentation related good first issues

https://github.com/pandas-dev/pandas/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+label%3ADocs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants