@@ -4719,8 +4719,7 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
47194719 cond , _ = cond .align (self , join = 'right' , broadcast_axis = 1 )
47204720 else :
47214721 if not hasattr (cond , 'shape' ):
4722- raise ValueError ('where requires an ndarray like object for '
4723- 'its condition' )
4722+ cond = np .asanyarray (cond )
47244723 if cond .shape != self .shape :
47254724 raise ValueError ('Array conditional must be same shape as '
47264725 'self' )
@@ -4878,26 +4877,20 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
48784877
48794878 Parameters
48804879 ----------
4881- cond : boolean %(klass)s, array or callable
4880+ cond : boolean %(klass)s, array-like, or callable
48824881 If cond is callable, it is computed on the %(klass)s and
4883- should return boolean %(klass)s or array.
4884- The callable must not change input %(klass)s
4885- (though pandas doesn't check it).
4882+ should return boolean %(klass)s or array. The callable must
4883+ not change input %(klass)s (though pandas doesn't check it).
48864884
48874885 .. versionadded:: 0.18.1
48884886
4889- A callable can be used as cond.
4890-
48914887 other : scalar, %(klass)s, or callable
48924888 If other is callable, it is computed on the %(klass)s and
4893- should return scalar or %(klass)s.
4894- The callable must not change input %(klass)s
4895- (though pandas doesn't check it).
4889+ should return scalar or %(klass)s. The callable must not
4890+ change input %(klass)s (though pandas doesn't check it).
48964891
48974892 .. versionadded:: 0.18.1
48984893
4899- A callable can be used as other.
4900-
49014894 inplace : boolean, default False
49024895 Whether to perform the operation in place on the data
49034896 axis : alignment axis if needed, default None
0 commit comments