@@ -8774,22 +8774,22 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
8774
8774
.. versionadded:: 0.18.1
8775
8775
A callable can be used as other.
8776
8776
8777
- inplace : boolean , default False
8777
+ inplace : bool , default False
8778
8778
Whether to perform the operation in place on the data.
8779
8779
axis : int, default None
8780
8780
Alignment axis if needed.
8781
8781
level : int, default None
8782
8782
Alignment level if needed.
8783
- errors : str, {'raise', 'ignore'}, default ` raise`
8783
+ errors : str, {'raise', 'ignore'}, default ' raise'
8784
8784
Note that currently this parameter won't affect
8785
8785
the results and will always coerce to a suitable dtype.
8786
8786
8787
- - ` raise` : allow exceptions to be raised.
8788
- - ` ignore` : suppress exceptions. On error return original object.
8787
+ - ' raise' : allow exceptions to be raised.
8788
+ - ' ignore' : suppress exceptions. On error return original object.
8789
8789
8790
- try_cast : boolean , default False
8790
+ try_cast : bool , default False
8791
8791
Try to cast the result back to the input type (if possible).
8792
- raise_on_error : boolean , default True
8792
+ raise_on_error : bool , default True
8793
8793
Whether to raise on invalid data types (e.g. trying to where on
8794
8794
strings).
8795
8795
@@ -8799,7 +8799,7 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
8799
8799
8800
8800
Returns
8801
8801
-------
8802
- wh : same type as caller
8802
+ Same type as caller
8803
8803
8804
8804
See Also
8805
8805
--------
@@ -8848,6 +8848,13 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
8848
8848
dtype: int64
8849
8849
8850
8850
>>> df = pd.DataFrame(np.arange(10).reshape(-1, 2), columns=['A', 'B'])
8851
+ >>> df
8852
+ A B
8853
+ 0 0 1
8854
+ 1 2 3
8855
+ 2 4 5
8856
+ 3 6 7
8857
+ 4 8 9
8851
8858
>>> m = df %% 3 == 0
8852
8859
>>> df.where(m, -df)
8853
8860
A B
0 commit comments