Skip to content

Commit d5f260b

Browse files
committed
added new test for weights
1 parent 11a239d commit d5f260b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/tests/plotting/test_series.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,23 @@ def test_kde_kwargs(self, ts, bw_method, ind):
538538
pytest.importorskip("scipy")
539539
_check_plot_works(ts.plot.kde, bw_method=bw_method, ind=ind)
540540

541+
@pytest.mark.parametrize(
542+
"bw_method, ind, weights",
543+
[
544+
["scott", 20, None],
545+
[None, 20, None],
546+
[None, np.int_(20), None],
547+
[0.5, np.linspace(-100, 100, 20), None],
548+
["scott", 40, np.linspace(0.0, 2.0, 50)],
549+
],
550+
)
551+
def test_kde_kwargs_weights(self, bw_method, ind, weights):
552+
# GH59337
553+
pytest.importorskip("scipy")
554+
s = Series(np.random.default_rng(2).uniform(size=50))
555+
# weights = np.linspace(0.0, 2.0, 50)
556+
_check_plot_works(s.plot.kde, bw_method=bw_method, ind=ind, weights=weights)
557+
541558
def test_density_kwargs(self, ts):
542559
pytest.importorskip("scipy")
543560
sample_points = np.linspace(-100, 100, 20)

0 commit comments

Comments
 (0)