0

input

Series([True, False, True]).replace('fdsa','lkjh')

output

0     lkjh
1    False
2     lkjh
dtype: object

I would expect:

0     True
1    False
2     True
dtype: bool

This makes it quite annoying to work with boolean data. What is the reasoning behind the current behaviour?

4
  • what exactly are you trying to do? Commented Feb 12, 2014 at 16:42
  • That is very strange. I cant figure out why it is doing that. If you roll back to version 0.12 it handles the Series replace correctly. Maybe raise an issue on Github? Commented Feb 12, 2014 at 16:56
  • 4
    its a trivial fix, see the issue here: github.com/pydata/pandas/issues/6332 (can also do s.astype(object).replace(....) Commented Feb 12, 2014 at 17:04
  • FYI This is now fixed in pandas master github.com/pydata/pandas/pull/6339. Commented Feb 13, 2014 at 12:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.