|
2 | 2 | import re
|
3 | 3 |
|
4 | 4 | import numpy as np
|
5 |
| -import pyarrow as pa |
6 | 5 | import pytest
|
7 | 6 |
|
| 7 | +from pandas.core.dtypes.dtypes import ArrowDtype |
| 8 | + |
8 | 9 | from pandas import (
|
9 | 10 | DataFrame,
|
10 | 11 | Index,
|
11 | 12 | MultiIndex,
|
12 | 13 | Series,
|
13 | 14 | _testing as tm,
|
14 | 15 | )
|
15 |
| -from pandas.core.dtypes.dtypes import ArrowDtype |
16 | 16 |
|
17 | 17 |
|
18 | 18 | def test_extract_expand_kwarg_wrong_type_raises(any_string_dtype):
|
@@ -710,16 +710,10 @@ def test_extractall_same_as_extract_subject_index(any_string_dtype):
|
710 | 710 | tm.assert_frame_equal(extract_one_noname, no_match_index)
|
711 | 711 |
|
712 | 712 |
|
713 |
| -@pytest.mark.parametrize( |
714 |
| - "data, expected_dtype", |
715 |
| - [ |
716 |
| - (Series(["abc", "ab"], dtype=ArrowDtype(pa.string())), "string[pyarrow]"), |
717 |
| - (Series(["abc", "ab"], dtype="string"), "string[python]"), |
718 |
| - (Series(["abc", "ab"]), "object"), |
719 |
| - ] |
720 |
| -) |
721 |
| -def test_extractall_preserves_dtype(data, expected_dtype): |
| 713 | +def test_extractall_preserves_dtype(): |
722 | 714 | # Ensure that when extractall is called on a series with specific dtypes set, that
|
723 | 715 | # the dtype is preserved in the resulting DataFrame's column.
|
724 |
| - result = data.str.extractall("(ab)") |
725 |
| - assert result.dtypes[0] == expected_dtype |
| 716 | + import pyarrow as pa |
| 717 | + |
| 718 | + result = Series(["abc", "ab"], dtype=ArrowDtype(pa.string())).str.extractall("(ab)") |
| 719 | + assert result.dtypes[0] == "string[pyarrow]" |
0 commit comments