Skip to content

Commit e7f3f0a

Browse files
committed
fix failure
1 parent b874308 commit e7f3f0a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pandas/core/dtypes/cast.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from pandas._libs import tslib, lib, tslibs
99
from pandas._libs.tslibs import iNaT, OutOfBoundsDatetime
10-
from pandas.compat import string_types, text_type, PY3
10+
from pandas.compat import string_types, text_type, to_str, PY3
1111
from .common import (ensure_object, is_bool, is_integer, is_float,
1212
is_complex, is_datetimetz, is_categorical_dtype,
1313
is_datetimelike,
@@ -1225,7 +1225,7 @@ def construct_1d_arraylike_from_scalar(value, length, dtype):
12251225
if isinstance(dtype, np.dtype) and dtype.kind in ("U", "S"):
12261226
subarr = np.empty(length, dtype=object)
12271227
if not isna(value):
1228-
value = text_type(value)
1228+
value = to_str(value)
12291229
else:
12301230
subarr = np.empty(length, dtype=dtype)
12311231
subarr.fill(value)

pandas/tests/series/test_constructors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def test_constructor_string_element_string_type(self):
154154

155155
def test_constructor_unicode_element_string_type(self):
156156
# GH 22477
157-
result = pd.Series(u'ѐ', index=[1], dtype=str)
158-
assert result.values.tolist() == [u'ѐ']
157+
result = pd.Series('ѐ', index=[1], dtype=str)
158+
assert result.values.tolist() == ['ѐ']
159159

160160
def test_constructor_dtype_str_na_values(self, string_dtype):
161161
# https://github.com/pandas-dev/pandas/issues/21083

0 commit comments

Comments
 (0)