Skip to content

Commit 6cd5f02

Browse files
committed
cleanup
1 parent 797f99c commit 6cd5f02

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/strings/accessor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,8 @@ def decode(self, encoding, errors: str = "strict", dtype: str | DtypeObj = None)
21502150
and not is_object_dtype(dtype)
21512151
):
21522152
raise ValueError(f"dtype must be string or object, got {dtype=}")
2153+
if dtype is None and get_option("future.infer_string"):
2154+
dtype = "str"
21532155
# TODO: Add a similar _bytes interface.
21542156
if encoding in _cpython_optimized_decoders:
21552157
# CPython optimized implementation
@@ -2159,8 +2161,6 @@ def decode(self, encoding, errors: str = "strict", dtype: str | DtypeObj = None)
21592161
f = lambda x: decoder(x, errors)[0]
21602162
arr = self._data.array
21612163
result = arr._str_map(f)
2162-
if dtype is None and get_option("future.infer_string"):
2163-
dtype = "str"
21642164
return self._wrap_result(result, dtype=dtype)
21652165

21662166
@forbid_nonstring_types(["bytes"])

0 commit comments

Comments
 (0)