-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Better error message for DataFrame.hist() without numerical columns (… #26483
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
@@ -2426,6 +2426,10 @@ def hist_frame(data, column=None, by=None, grid=True, xlabelsize=None, | |||
data = data._get_numeric_data() | |||
naxes = len(data.columns) | |||
|
|||
if naxes == 0: |
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.
if naxes == 0: | |
if not naxes: |
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 prefer how it is. This is more explicit.
Codecov Report
@@ Coverage Diff @@
## master #26483 +/- ##
==========================================
- Coverage 91.75% 91.74% -0.02%
==========================================
Files 174 174
Lines 50756 50758 +2
==========================================
- Hits 46572 46568 -4
- Misses 4184 4190 +6
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #26483 +/- ##
==========================================
- Coverage 91.75% 91.74% -0.02%
==========================================
Files 174 174
Lines 50756 50763 +7
==========================================
- Hits 46572 46570 -2
- Misses 4184 4193 +9
Continue to review full report at Codecov.
|
thanks for the PR. the CI failure looks unrelated to your change. can you add a test, perhaps using the code sample in the issue as the test case? |
Thanks for the code review @simonjayhawkins. I just added a test in the way you suggested. |
Co-Authored-By: Simon Hawkins <[email protected]>
Co-Authored-By: Simon Hawkins <[email protected]>
lgtm, not sure about marking the test as slow, is it really slow? Also, if this can wait until #26414 that would make my life a bit easier (will be much easier to resolve the conflict here than there). |
that had crossed my mind, but all the tests in this module are marked as slow, so was thinking that it would be better to mark as slow at the module level as a follow-up at some point. |
thanks @matsmaiwald |
Closes #10444
Added simple check for non-zero number of numeric columns plus suggested error message in case the check fails.
Happy to make any adjustments this if desired.