-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
can you update |
closing as stale. pls ping to reopen if you want to continue. |
git diff upstream/master -u -- "*.py" | flake8 --diff