Skip to content

DOC: Adding clarification on return dtype of to_numeric #21585

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

Merged
merged 4 commits into from
Jun 22, 2018

Conversation

uds5501
Copy link
Contributor

@uds5501 uds5501 commented Jun 22, 2018

Specifying the default return types for to_numeric in case of no downcast

Specifying the default return types for `to_numeric` in case of no downcast
@codecov
Copy link

codecov bot commented Jun 22, 2018

Codecov Report

Merging #21585 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #21585      +/-   ##
==========================================
+ Coverage    91.9%    91.9%   +<.01%     
==========================================
  Files         153      153              
  Lines       49549    49549              
==========================================
+ Hits        45537    45539       +2     
+ Misses       4012     4010       -2
Flag Coverage Δ
#multiple 90.3% <ø> (ø) ⬆️
#single 41.78% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/tools/numeric.py 100% <ø> (ø) ⬆️
pandas/util/testing.py 85.27% <0%> (+0.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1ffc5f...1df5200. Read the comment docs.

@gfyoung gfyoung added Docs Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations labels Jun 22, 2018
@jorisvandenbossche jorisvandenbossche changed the title [DOC]: Adding clarification on return dtype of to_numeric DOC: Adding clarification on return dtype of to_numeric Jun 22, 2018
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@@ -43,6 +43,10 @@ def to_numeric(arg, errors='raise', downcast=None):
checked satisfy that specification, no downcasting will be
performed on the data.

Also Note that the default return dtype is `float64` or `int64`
depending on the data supplied.`downcast` for `float` or `int`
should only be used if output desired is `float32` or `int32`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe add something like this to the "extended summary" (just after the first line of the docstring), so something like:

Convert argument to a numeric type.

The default return dtype is `float64` or `int64` depending on the data supplied. 
Use the `downcast` parameter to obtain other dtypes.

Parameters
-----------
...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorisvandenbossche Sure, I will modify the PR asap

Adding the explanation in extended summary
@pep8speaks
Copy link

pep8speaks commented Jun 22, 2018

Hello @uds5501! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on June 22, 2018 at 10:05 Hours UTC

@jreback jreback added this to the 0.24.0 milestone Jun 22, 2018
@jreback jreback merged commit 4795e8c into pandas-dev:master Jun 22, 2018
@jreback
Copy link
Contributor

jreback commented Jun 22, 2018

thanks!

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_numeric not correctly converting decimal type to float
5 participants