File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -596,6 +596,31 @@ You can also operate on the DataFrame in place
596
596
597
597
df.replace(1.5 , nan, inplace = True )
598
598
599
+ .. warning ::
600
+
601
+ When replacing multiple ``bool `` or ``datetime64 `` objects, the first
602
+ argument to ``replace `` (``to_replace ``) must match the type of the value
603
+ being replaced type. For example,
604
+
605
+ .. code-block ::
606
+
607
+ s = Series([True, False, True])
608
+ s.replace({'a string': 'new value', True: False})
609
+
610
+ will raise a ``TypeError `` because one of the ``dict `` keys is not of the
611
+ correct type for replacement.
612
+
613
+ However, when replacing a *single * object such as,
614
+
615
+ .. code-block ::
616
+
617
+ s = Series([True, False, True])
618
+ s.replace('a string', 'another string')
619
+
620
+ the original ``NDFrame `` object will be returned untouched. We're working on
621
+ unifying this API, but for backwards compatibility reasons we cannot break
622
+ the latter behavior. See :issue: `6354 ` for more details.
623
+
599
624
Missing data casting rules and indexing
600
625
---------------------------------------
601
626
You can’t perform that action at this time.
0 commit comments