MCPcopy
hub / github.com/pandas-dev/pandas / test_value_counts_series

Method test_value_counts_series

pandas/tests/test_algos.py:1436–1447  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1434 tm.assert_series_equal(result, expected)
1435
1436 def test_value_counts_series(self):
1437 # GH#54857
1438 values = np.array([3, 1, 2, 3, 4, np.nan])
1439 result = Series(values).value_counts(bins=3)
1440 expected = Series(
1441 [2, 2, 1],
1442 index=IntervalIndex.from_tuples(
1443 [(0.996, 2.0), (2.0, 3.0), (3.0, 4.0)], dtype="interval[float64, right]"
1444 ),
1445 name="count",
1446 )
1447 tm.assert_series_equal(result, expected)
1448
1449 def test_value_counts_stability(self):
1450 # GH 63155

Callers

nothing calls this directly

Calls 4

SeriesClass · 0.90
arrayMethod · 0.45
value_countsMethod · 0.45
from_tuplesMethod · 0.45

Tested by

no test coverage detected