(self)
| 179 | tm.assert_index_equal(uniques, exp) |
| 180 | |
| 181 | def test_factorize_period(self): |
| 182 | # period |
| 183 | v1 = Period("201302", freq="M") |
| 184 | v2 = Period("201303", freq="M") |
| 185 | x = Series([v1, v1, v1, v2, v2, v1]) |
| 186 | |
| 187 | # periods are not 'sorted' as they are converted back into an index |
| 188 | codes, uniques = algos.factorize(x) |
| 189 | exp = np.array([0, 0, 0, 1, 1, 0], dtype=np.intp) |
| 190 | tm.assert_numpy_array_equal(codes, exp) |
| 191 | tm.assert_index_equal(uniques, PeriodIndex([v1, v2])) |
| 192 | |
| 193 | codes, uniques = algos.factorize(x, sort=True) |
| 194 | exp = np.array([0, 0, 0, 1, 1, 0], dtype=np.intp) |
| 195 | tm.assert_numpy_array_equal(codes, exp) |
| 196 | tm.assert_index_equal(uniques, PeriodIndex([v1, v2])) |
| 197 | |
| 198 | def test_factorize_timedelta(self): |
| 199 | # GH 5986 |
nothing calls this directly
no test coverage detected