File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -602,17 +602,19 @@ You can also operate on the DataFrame in place
602602 argument to ``replace `` (``to_replace ``) must match the type of the value
603603 being replaced type. For example,
604604
605- .. code-block ::
605+ .. code-block :: python
606606
607607 s = Series([True , False , True ])
608- s.replace({'a string': 'new value', True: False})
608+ s.replace({' a string' : ' new value' , True : False }) # raises
609+
610+ TypeError : Cannot compare types ' ndarray(dtype=bool)' and ' str'
609611
610612 will raise a ``TypeError `` because one of the ``dict `` keys is not of the
611613 correct type for replacement.
612614
613615 However, when replacing a *single * object such as,
614616
615- .. code-block ::
617+ .. ipython :: python
616618
617619 s = Series([True , False , True ])
618620 s.replace(' a string' , ' another string' )
You can’t perform that action at this time.
0 commit comments