Skip to content

Commit f8d4e70

Browse files
committed
remove mixed-string
1 parent dd02d69 commit f8d4e70

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

pandas/_libs/lib.pyx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,6 @@ def infer_dtype(value: object, skipna: object=None) -> str:
11131113
Results can include:
11141114

11151115
- string
1116-
- mixed-string
11171116
- unicode
11181117
- bytes
11191118
- floating
@@ -1320,11 +1319,9 @@ def infer_dtype(value: object, skipna: object=None) -> str:
13201319
return 'boolean'
13211320

13221321
elif isinstance(val, str):
1322+
# we deliberately ignore skipna
13231323
if is_string_array(values, skipna=True):
1324-
if isnaobj(values).any():
1325-
return "mixed-string"
1326-
else:
1327-
return "string"
1324+
return "string"
13281325

13291326
elif isinstance(val, bytes):
13301327
if is_bytes_array(values, skipna=skipna):

pandas/core/construction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def array(
302302
# timedelta, timedelta64
303303
return TimedeltaArray._from_sequence(data, copy=copy)
304304

305-
elif inferred_dtype in {"string", "mixed-string"}:
305+
elif inferred_dtype == "string":
306306
return StringArray._from_sequence(data, copy=copy)
307307

308308
elif inferred_dtype in {"integer", "mixed-integer"}:

pandas/tests/dtypes/test_inference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def test_string(self):
732732
def test_unicode(self):
733733
arr = ["a", np.nan, "c"]
734734
result = lib.infer_dtype(arr, skipna=False)
735-
assert result == "mixed-string"
735+
assert result == "string"
736736

737737
arr = ["a", np.nan, "c"]
738738
result = lib.infer_dtype(arr, skipna=True)

pandas/tests/frame/test_block_internals.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -615,12 +615,12 @@ def test_constructor_no_pandas_array(self):
615615
def test_add_column_with_pandas_array(self):
616616
# GH 26390
617617
df = pd.DataFrame({"a": [1, 2, 3, 4], "b": ["a", "b", "c", "d"]})
618-
df["c"] = pd.array([1, 2, None, 3])
618+
df["c"] = pd.arrays.PandasArray(np.array([1, 2, None, 3], dtype=object))
619619
df2 = pd.DataFrame(
620620
{
621621
"a": [1, 2, 3, 4],
622622
"b": ["a", "b", "c", "d"],
623-
"c": pd.array([1, 2, None, 3]),
623+
"c": pd.arrays.PandasArray(np.array([1, 2, None, 3], dtype=object)),
624624
}
625625
)
626626
assert type(df["c"]._data.blocks[0]) == ObjectBlock

pandas/tests/internals/test_internals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ def test_block_shape():
12681268

12691269
def test_make_block_no_pandas_array():
12701270
# https://github.com/pandas-dev/pandas/pull/24866
1271-
arr = pd.array([1, 2])
1271+
arr = pd.arrays.PandasArray(np.array([1, 2]))
12721272

12731273
# PandasArray, no dtype
12741274
result = make_block(arr, slice(len(arr)))

0 commit comments

Comments
 (0)