Uh oh!
There was an error while loading. Please reload this page.
Fix create_violin() TypeError with numpy >= 2.0 - #5538
Closed
wavebyrd wants to merge 6035 commits into
Closed
Conversation
Version changes for v6.3.0
Add docs updates for Plotly.py v6.3
…py-6.3.0 Update docs to plotly.py 6.3.0
Fixesplotly#5253 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Co-authored-by: Emily KL <4672118+emilykl@users.noreply.github.com>
Co-authored-by: Emily KL <4672118+emilykl@users.noreply.github.com>
update Plotly.py version and date
…aults Copy width/height calculating logic from kaleido
Update CITATION.cff
Add missing imports and variable definitions (for main)
Add missing imports and variable definitions
Update links breaking docs build
Add maki symbols list
Update CONTRIBUTING.md to include jupyter lab local development instr…
upgrade plotly.js to v3.4.0
Update docs to latest plotly.py version
Update API reference doc version
Update pull request template
When px.histogram() is called with no data arguments, the histogram- specific hover label path inserts a None key into mapping_labels (because attr_label is None when no column is specified). The hover template list comprehension then fails with: TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' Skip adding to mapping_labels when attr_label is None, consistent with how other chart types handle empty invocations. Fixesplotly#5534
fix: handle empty px.histogram() by skipping None label in hover template
…ed-build-dependencies Remove not required build dependencies
np.percentile() renamed its `interpolation` kwarg to `method` in numpy 1.22, and the old name was removed in numpy 2.0. This caused create_violin() to raise a TypeError on numpy >= 2.0. Use a version check to pick the right kwarg name so the function works on both old and new numpy. Fixesplotly#5461
wavebyrdforce-pushed
the
fix-violin-numpy-2.4-percentile
branch
from
March 13, 2026 21:36
132a7e8 to
2d122fdComparewavebyrd
commented
Mar 16, 2026
Author
Ping on this numpy 2.0 compatibility fix for create_violin(). Ready for review! |
camdecoster
commented
Mar 18, 2026
Contributor
Thanks for the contribution! This issue was already addressed in #5483 (which just merged), so I'm going to close this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_violin()callsnp.percentile()with theinterpolationkwarg, which was renamed tomethodin numpy 1.22 and fully removed in numpy 2.0. This causes aTypeErroron any numpy >= 2.0 install.methodfor >= 1.22,interpolationfor older releases), keeping backward compatibility intact.Fixes#5461
Test plan
create_violin(data=[1, 2])no longer raisesTypeErroron numpy >= 2.0pytest tests/test_optional/test_figure_factory/test_figure_factory.py::TestViolin::test_violin_figinterpolationis accepted