(self, frame_or_series)
| 14 | |
| 15 | class TestToPeriod: |
| 16 | def test_to_period(self, frame_or_series): |
| 17 | K = 5 |
| 18 | |
| 19 | dr = date_range("1/1/2000", "1/1/2001", freq="D") |
| 20 | obj = DataFrame( |
| 21 | np.random.default_rng(2).standard_normal((len(dr), K)), |
| 22 | index=dr, |
| 23 | columns=["A", "B", "C", "D", "E"], |
| 24 | ) |
| 25 | obj["mix"] = "a" |
| 26 | obj = tm.get_obj(obj, frame_or_series) |
| 27 | |
| 28 | pts = obj.to_period() |
| 29 | exp = obj.copy() |
| 30 | exp.index = period_range("1/1/2000", "1/1/2001") |
| 31 | tm.assert_equal(pts, exp) |
| 32 | |
| 33 | pts = obj.to_period("M") |
| 34 | exp.index = exp.index.asfreq("M") |
| 35 | tm.assert_equal(pts, exp) |
| 36 | |
| 37 | def test_to_period_without_freq(self, frame_or_series): |
| 38 | # GH#7606 without freq |
nothing calls this directly
no test coverage detected