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

Check for categorical data to histogram #5540

Merged
merged 3 commits into from
Jan 11, 2023
Merged

Check for categorical data to histogram #5540

merged 3 commits into from
Jan 11, 2023

Conversation

MarcSkovMadsen
Copy link
Collaborator

@MarcSkovMadsen MarcSkovMadsen commented Dec 3, 2022

Addresses hvplot/#998 by providing an error message if the user tries to create a histogram from categorical data.

Before the user would get the error message numpy.core._exceptions._UFuncNoLoopError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U1'), dtype('float64')) -> None

This is not an error message that a new user to python and plotting would be able to make sense of. It takes a long time to realize that theoretically a histogram is for numerical data only. For example users can find plotly express examples of creating "histograms" from categorical data. In their documentation its the second example you see. I think they realized this is a very common use case.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2022

Codecov Report

Merging #5540 (6247adc) into main (fba7697) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5540   +/-   ##
=======================================
  Coverage   88.22%   88.22%           
=======================================
  Files         302      302           
  Lines       62179    62187    +8     
=======================================
+ Hits        54857    54865    +8     
  Misses       7322     7322           
Impacted Files Coverage Δ
holoviews/operation/element.py 71.79% <100.00%> (+0.10%) ⬆️
holoviews/tests/operation/test_operation.py 99.19% <100.00%> (+0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Dec 3, 2022

The tests fails on Python 3.11 only and I believe its not related to this PR. This should be ready for review.

@jlstevens
Copy link
Contributor

@MarcSkovMadsen Change makes good sense to me. Hopefully the tests will now pass (including 3.11) after the merge commit at which point I am happy to see this merge.

@jlstevens
Copy link
Contributor

Looks like all tests are now green!

@hoxbro hoxbro merged commit 733af92 into main Jan 11, 2023
@hoxbro hoxbro deleted the fix/hist-error-message branch January 11, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants