Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach committed Feb 16, 2025
1 parent 797f99c commit 6cd5f02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/core/strings/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,8 @@ def decode(self, encoding, errors: str = "strict", dtype: str | DtypeObj = None)
and not is_object_dtype(dtype)
):
raise ValueError(f"dtype must be string or object, got {dtype=}")
if dtype is None and get_option("future.infer_string"):
dtype = "str"
# TODO: Add a similar _bytes interface.
if encoding in _cpython_optimized_decoders:
# CPython optimized implementation
Expand All @@ -2159,8 +2161,6 @@ def decode(self, encoding, errors: str = "strict", dtype: str | DtypeObj = None)
f = lambda x: decoder(x, errors)[0]
arr = self._data.array
result = arr._str_map(f)
if dtype is None and get_option("future.infer_string"):
dtype = "str"
return self._wrap_result(result, dtype=dtype)

@forbid_nonstring_types(["bytes"])
Expand Down

0 comments on commit 6cd5f02

Please sign in to comment.