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

Method test_repeat

pandas/tests/series/methods/test_repeat.py:12–22  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10
11class TestRepeat:
12 def test_repeat(self):
13 ser = Series(np.random.default_rng(2).standard_normal(3), index=["a", "b", "c"])
14
15 reps = ser.repeat(5)
16 exp = Series(ser.values.repeat(5), index=ser.index.values.repeat(5))
17 tm.assert_series_equal(reps, exp)
18
19 to_rep = [2, 3, 4]
20 reps = ser.repeat(to_rep)
21 exp = Series(ser.values.repeat(to_rep), index=ser.index.values.repeat(to_rep))
22 tm.assert_series_equal(reps, exp)
23
24 def test_numpy_repeat(self):
25 ser = Series(np.arange(3), name="x")

Callers

nothing calls this directly

Calls 2

repeatMethod · 0.95
SeriesClass · 0.90

Tested by

no test coverage detected