Skip to content

Commit 64ea6a8

Browse files
keep string instead of large_string for ArrowDtype
1 parent d01326f commit 64ea6a8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pandas/_libs/parsers.pyx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import warnings
1010

1111
from pandas.util._exceptions import find_stack_level
1212

13-
from pandas import StringDtype
13+
from pandas import (
14+
ArrowDtype,
15+
StringDtype,
16+
)
1417
from pandas.core.arrays import (
1518
ArrowExtensionArray,
1619
BooleanArray,
@@ -43,7 +46,6 @@ from libc.string cimport (
4346
strncpy,
4447
)
4548

46-
4749
import numpy as np
4850

4951
cimport numpy as cnp
@@ -1452,7 +1454,13 @@ def _maybe_upcast(
14521454

14531455
elif arr.dtype == np.object_:
14541456
if use_dtype_backend:
1455-
dtype = StringDtype()
1457+
if dtype_backend == "pyarrow":
1458+
# using the StringDtype below would use large_string by default
1459+
# keep here to pyarrow's default of string
1460+
import pyarrow as pa
1461+
dtype = ArrowDtype(pa.string())
1462+
else:
1463+
dtype = StringDtype()
14561464
cls = dtype.construct_array_type()
14571465
arr = cls._from_sequence(arr, dtype=dtype)
14581466

0 commit comments

Comments
 (0)