Skip to content

Commit b55ce9a

Browse files
committed
Fix numpy 2.4.0 compatibility in create_violin()
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'.
1 parent 55597ab commit b55ce9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plotly/figure_factory/_violin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def calc_stats(data):
1717
x = np.asarray(data, float)
1818
vals_min = np.min(x)
1919
vals_max = np.max(x)
20-
q2 = np.percentile(x, 50, interpolation="linear")
21-
q1 = np.percentile(x, 25, interpolation="lower")
22-
q3 = np.percentile(x, 75, interpolation="higher")
20+
q2 = np.percentile(x, 50, method="linear")
21+
q1 = np.percentile(x, 25, method="lower")
22+
q3 = np.percentile(x, 75, method="higher")
2323
iqr = q3 - q1
2424
whisker_dist = 1.5 * iqr
2525

0 commit comments

Comments
 (0)