(any_string_dtype)
| 502 | |
| 503 | |
| 504 | def test_extractall_single_group(any_string_dtype): |
| 505 | s = Series(["a3", "b3", "d4c2"], name="series_name", dtype=any_string_dtype) |
| 506 | expected_index = MultiIndex.from_tuples( |
| 507 | [(0, 0), (1, 0), (2, 0), (2, 1)], names=(None, "match") |
| 508 | ) |
| 509 | |
| 510 | # extractall(one named group) returns DataFrame with one named column. |
| 511 | result = s.str.extractall(r"(?P<letter>[a-z])") |
| 512 | expected = DataFrame( |
| 513 | {"letter": ["a", "b", "d", "c"]}, index=expected_index, dtype=any_string_dtype |
| 514 | ) |
| 515 | tm.assert_frame_equal(result, expected) |
| 516 | |
| 517 | # extractall(one un-named group) returns DataFrame with one un-named column. |
| 518 | result = s.str.extractall(r"([a-z])") |
| 519 | expected = DataFrame( |
| 520 | ["a", "b", "d", "c"], index=expected_index, dtype=any_string_dtype |
| 521 | ) |
| 522 | tm.assert_frame_equal(result, expected) |
| 523 | |
| 524 | |
| 525 | def test_extractall_single_group_with_quantifier(any_string_dtype): |
nothing calls this directly
no test coverage detected