Skip to content

Commit 8272c16

Browse files
phoflKevin D Smith
authored and
Kevin D Smith
committed
TST: DataFrame.replace: TypeError: Cannot compare types 'ndarray(dtype=int64)' and 'unicode' (pandas-dev#36202)
1 parent 24181c0 commit 8272c16

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/frame/methods/test_replace.py

+8
Original file line numberDiff line numberDiff line change
@@ -1599,3 +1599,11 @@ def test_replace_intervals(self):
15991599
result = df.replace({"a": {pd.Interval(0, 1): "x"}})
16001600
expected = pd.DataFrame({"a": ["x", "x"]})
16011601
tm.assert_frame_equal(result, expected)
1602+
1603+
def test_replace_unicode(self):
1604+
# GH: 16784
1605+
columns_values_map = {"positive": {"正面": 1, "中立": 1, "负面": 0}}
1606+
df1 = pd.DataFrame({"positive": np.ones(3)})
1607+
result = df1.replace(columns_values_map)
1608+
expected = pd.DataFrame({"positive": np.ones(3)})
1609+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)