Skip to content

Commit f88f0c5

Browse files
Switch default string storage from python to pyarrow (if installed) also for NA-variant of the StringDtype
1 parent 23aae9f commit f88f0c5

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

pandas/core/arrays/string_.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,11 @@ def __init__(
154154
) -> None:
155155
# infer defaults
156156
if storage is None:
157-
if na_value is not libmissing.NA:
158-
storage = get_option("mode.string_storage")
159-
if storage == "auto":
160-
if HAS_PYARROW:
161-
storage = "pyarrow"
162-
else:
163-
storage = "python"
164-
else:
165-
storage = get_option("mode.string_storage")
166-
if storage == "auto":
157+
storage = get_option("mode.string_storage")
158+
if storage == "auto":
159+
if HAS_PYARROW:
160+
storage = "pyarrow"
161+
else:
167162
storage = "python"
168163

169164
if storage == "pyarrow_numpy":

pandas/tests/arrays/string_/test_string_arrow.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55
import pytest
66

7+
from pandas.compat import HAS_PYARROW
78
import pandas.util._test_decorators as td
89

910
import pandas as pd
@@ -26,10 +27,10 @@ def test_eq_all_na():
2627
tm.assert_extension_array_equal(result, expected)
2728

2829

29-
def test_config(string_storage, using_infer_string):
30+
def test_config(string_storage):
3031
# with the default string_storage setting
3132
# always "python" at the moment
32-
assert StringDtype().storage == "python"
33+
assert StringDtype().storage == "pyarrow" if HAS_PYARROW else "python"
3334

3435
with pd.option_context("string_storage", string_storage):
3536
assert StringDtype().storage == string_storage

0 commit comments

Comments
 (0)