Skip to content

ERR: Improved error message and updated doc in cut/qcut (issue 13318) #16982

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
wants to merge 1 commit into from

Conversation

Treesbark
Copy link

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

pls add a whatsnew entry as well

@@ -44,7 +44,7 @@ def cut(x, bins, right=True, labels=None, retbins=False, precision=3,
labels : array or boolean, default None
Copy link
Contributor

Choose a reason for hiding this comment

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

how about labels: array or False, default None

@@ -155,7 +155,7 @@ def qcut(x, q, labels=None, retbins=False, precision=3, duplicates='raise'):
labels : array or boolean, default None
Used as labels for the resulting bins. Must be of the same length as
the resulting bins. If False, return only integer indicators of the
Copy link
Contributor

Choose a reason for hiding this comment

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

same

@@ -245,7 +245,10 @@ def _bins_to_cuts(x, bins, right=True, labels=None,
has_nas = na_mask.any()

if labels is not False:
if labels is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would do something more along the lines

if labels is None:
    .....
elif is_list_like(labels):
    .....
else:
     raise

@@ -326,6 +326,12 @@ def test_series_retbins(self):
ordered=True)
tm.assert_series_equal(result, expected)

def test_qcut_labels_true(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

cycle thru a few more things that are not valid (you can use parametrize) , e.g. 'foo', 1

@jreback jreback added Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Jul 16, 2017
@codecov
Copy link

codecov bot commented Jul 16, 2017

Codecov Report

Merging #16982 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16982      +/-   ##
==========================================
- Coverage   90.99%   90.97%   -0.02%     
==========================================
  Files         161      161              
  Lines       49293    49295       +2     
==========================================
- Hits        44854    44847       -7     
- Misses       4439     4448       +9
Flag Coverage Δ
#multiple 88.74% <100%> (ø) ⬆️
#single 40.19% <0%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/reshape/tile.py 90.38% <100%> (+0.12%) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.76% <0%> (-0.1%) ⬇️

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 692b5ee...8fa0860. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 16, 2017

Codecov Report

Merging #16982 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16982      +/-   ##
==========================================
- Coverage   90.99%   90.97%   -0.02%     
==========================================
  Files         161      161              
  Lines       49293    49295       +2     
==========================================
- Hits        44854    44847       -7     
- Misses       4439     4448       +9
Flag Coverage Δ
#multiple 88.74% <100%> (ø) ⬆️
#single 40.19% <0%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/reshape/tile.py 90.38% <100%> (+0.12%) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.76% <0%> (-0.1%) ⬇️

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 692b5ee...8fa0860. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Jul 19, 2017

can you update

@jreback
Copy link
Contributor

jreback commented Sep 10, 2017

closing as stale. pls ping to reopen if you want to continue.

@jreback jreback closed this Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERR: cut/qcut need better error message when passing invalid input
2 participants