We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bd31b2b commit e6e4971Copy full SHA for e6e4971
pandas/tests/series/test_replace.py
@@ -227,9 +227,23 @@ def test_replace_with_empty_dictlike(self):
227
tm.assert_series_equal(s, s.replace(dict()))
228
tm.assert_series_equal(s, s.replace(pd.Series([])))
229
230
- def test_replace_string_with_nan(self):
+ def test_replace_string_with_number(self):
231
# GH 15743
232
s = pd.Series([1, 2, 3])
233
result = s.replace('2', np.nan)
234
expected = pd.Series([1, 2, 3])
235
tm.assert_series_equal(expected, result)
236
+
237
+ def test_replace_unicode_with_number(self):
238
+ # GH 15743
239
+ s = pd.Series([1, 2, 3])
240
+ result = s.replace(u'2', np.nan)
241
+ expected = pd.Series([1, 2, 3])
242
+ tm.assert_series_equal(expected, result)
243
244
+ def test_replace_mixed_types_with_string(self):
245
+ # Testing mixed
246
+ s = pd.Series([1, 2, 3, '4', 4, 5])
247
+ result = s.replace([2, '4'], np.nan)
248
+ expected = pd.Series([1, np.nan, 3, np.nan, 4, 5])
249
0 commit comments