Skip to content

DOC: use ipython in bool replace doc warning #6412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions doc/source/missing_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -602,17 +602,19 @@ You can also operate on the DataFrame in place
argument to ``replace`` (``to_replace``) must match the type of the value
being replaced type. For example,

.. code-block::
.. code-block:: python

s = Series([True, False, True])
s.replace({'a string': 'new value', True: False})
s.replace({'a string': 'new value', True: False}) # raises

TypeError: Cannot compare types 'ndarray(dtype=bool)' and 'str'

will raise a ``TypeError`` because one of the ``dict`` keys is not of the
correct type for replacement.

However, when replacing a *single* object such as,

.. code-block::
.. ipython:: python

s = Series([True, False, True])
s.replace('a string', 'another string')
Expand Down