Sitelet https://web.archive.org/web/20200820055800/https://github.com/pandas-dev/pandas/issues/35760
Skip to content
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

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

Closed
languitar opened this issue Aug 17, 2020 · 3 comments
Closed

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

languitar opened this issue Aug 17, 2020 · 3 comments
Milestone

Comments

@languitar
Copy link

@languitar languitar commented Aug 17, 2020

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

@simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Aug 17, 2020

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

@Anupam-USP
Copy link

@Anupam-USP Anupam-USP commented Aug 19, 2020

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

@simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Aug 19, 2020

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
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.