Skip to content

Commit a912bd8

Browse files
test current setup
1 parent 8eec58e commit a912bd8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pandas/core/strings/accessor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2482,9 +2482,11 @@ def get_dummies(
24822482
1 False False False
24832483
2 True False True
24842484
"""
2485+
from pandas.core.dtypes.common import is_string_dtype
2486+
24852487
from pandas.core.frame import DataFrame
24862488

2487-
if dtype in (str, "str[pyarrow]"):
2489+
if is_string_dtype(dtype):
24882490
raise ValueError("string dtype not supported, please use a numeric dtype")
24892491
# we need to cast to Series of strings as only that has all
24902492
# methods available for making the dummies...

pandas/tests/strings/test_get_dummies.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import numpy as np
22
import pytest
33

4-
from pandas._config import using_string_dtype
5-
64
import pandas.util._test_decorators as td
75

86
from pandas import (
@@ -13,6 +11,11 @@
1311
_testing as tm,
1412
)
1513

14+
try:
15+
import pyarrow as pa
16+
except ImportError:
17+
pa = None
18+
1619

1720
def test_get_dummies(any_string_dtype):
1821
s = Series(["a|b", "a|c", np.nan], dtype=any_string_dtype)
@@ -93,7 +96,6 @@ def test_get_dummies_with_pyarrow_dtype(any_string_dtype, dtype):
9396

9497

9598
# GH#47872
96-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
9799
def test_get_dummies_with_str_dtype(any_string_dtype):
98100
s = Series(["a|b", "a|c", np.nan], dtype=any_string_dtype)
99101
with pytest.raises(

0 commit comments

Comments
 (0)