Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/core/strings/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import numpy as np

from pandas._config import get_option
from pandas._config import using_string_dtype

from pandas._libs import lib
from pandas._typing import (
Expand Down Expand Up @@ -2123,7 +2123,7 @@ def decode(
"""
if dtype is not None and not is_string_dtype(dtype):
raise ValueError(f"dtype must be string or object, got {dtype=}")
if dtype is None and get_option("future.infer_string"):
if dtype is None and using_string_dtype():
dtype = "str"
# TODO: Add a similar _bytes interface.
if encoding in _cpython_optimized_decoders:
Expand Down
8 changes: 4 additions & 4 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@ def convert(
except UnicodeEncodeError as err:
if (
errors == "surrogatepass"
and get_option("future.infer_string")
and using_string_dtype()
and str(err).endswith("surrogates not allowed")
and HAS_PYARROW
):
Expand Down Expand Up @@ -3214,7 +3214,7 @@ def read_index_node(
except UnicodeEncodeError as err:
if (
self.errors == "surrogatepass"
and get_option("future.infer_string")
and using_string_dtype()
and str(err).endswith("surrogates not allowed")
and HAS_PYARROW
):
Expand Down Expand Up @@ -3365,7 +3365,7 @@ def read(
except UnicodeEncodeError as err:
if (
self.errors == "surrogatepass"
and get_option("future.infer_string")
and using_string_dtype()
and str(err).endswith("surrogates not allowed")
and HAS_PYARROW
):
Expand Down Expand Up @@ -4829,7 +4829,7 @@ def read(
except UnicodeEncodeError as err:
if (
self.errors == "surrogatepass"
and get_option("future.infer_string")
and using_string_dtype()
and str(err).endswith("surrogates not allowed")
and HAS_PYARROW
):
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/sas/sas7bdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import numpy as np

from pandas._config import get_option
from pandas._config import using_string_dtype

from pandas._libs.byteswap import (
read_double_with_byteswap,
Expand Down Expand Up @@ -699,7 +699,7 @@ def _chunk_to_dataframe(self) -> DataFrame:
rslt = {}

js, jb = 0, 0
infer_string = get_option("future.infer_string")
infer_string = using_string_dtype()
for j in range(self.column_count):
name = self.column_names[j]

Expand Down
Loading