GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix numpy 2.4.0 compatibility in create_violin() by Mr-Neutr0n · Pull Request #5483 · plotly/plotly.py

Conversation

@Mr-Neutr0n

@Mr-Neutr0n Mr-Neutr0n commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #5461

The interpolation parameter was deprecated in numpy.percentile() and removed in numpy 2.4.0. It has been replaced with the method parameter which uses the same values.

Problem

create_violin() fails with numpy 2.4.0:

TypeError: percentile() got an unexpected keyword argument 'interpolation'

Solution

Changed all three np.percentile() calls in calc_stats() from using interpolation to method:

  • interpolation="linear" → method="linear"
  • interpolation="lower" → method="lower"
  • interpolation="higher" → method="higher"

Changes

Modified plotly/figure_factory/_violin.py:

# Before
q2 = np.percentile(x, 50, interpolation="linear")
q1 = np.percentile(x, 25, interpolation="lower")
q3 = np.percentile(x, 75, interpolation="higher")

# After
q2 = np.percentile(x, 50, method="linear")
q1 = np.percentile(x, 25, method="lower")
q3 = np.percentile(x, 75, method="higher")

Test plan

import plotly.figure_factory as ff
fig = ff.create_violin(data=[1, 2, 3, 4, 5])
fig.show()  # Should work without error

Or run the existing test:

pytest tests/test_optional/test_figure_factory/test_figure_factory.py::TestViolin::test_violin_fig

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Mr-Neutr0n
Fix numpy 2.4.0 compatibility in create_violin()
b55ce9a
Fixes #5461

The 'interpolation' parameter was deprecated in numpy.percentile() and
removed in numpy 2.4.0. It has been replaced with the 'method' parameter
which uses the same values.

Changed all three np.percentile() calls in calc_stats() from using
'interpolation' to 'method'.
@camdecoster camdecoster self-assigned this Feb 6, 2026
@camdecoster

camdecoster commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Thank you for the PR. I'll take a look and follow up.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

camdecoster added 3 commits March 17, 2026 16:39
@camdecoster
Merge remote-tracking branch 'origin/main' into fix-numpy-percentile-…
2f239b2
…issue-5461
@camdecoster
Add numpy minimum version
94ad286
@camdecoster
Update changelog
5f242ef
camdecoster
camdecoster approved these changes Mar 17, 2026
View reviewed changes

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

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.

Looks good. I added a minimum version requirement for numpy and added a changelog entry. Thanks for your contribution!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@camdecoster
Update uv lock file
12846fc
@camdecoster
camdecoster merged commit b009b25 into plotly:main Mar 18, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@camdecoster camdecoster mentioned this pull request Mar 18, 2026
Fix create_violin() TypeError with numpy >= 2.0 #5538
Closed
3 tasks
@camdecoster camdecoster mentioned this pull request Apr 8, 2026
Fix violin plot compatibility with NumPy 2.4+ #5505
Closed
2 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@camdecoster camdecoster camdecoster approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@camdecoster camdecoster

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG]: create_violin() failure with numpy==2.4.0: TypeError: percentile() got an unexpected keyword argument 'interpolation'

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Mr-Neutr0n @camdecoster
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.