@@ -4719,8 +4719,7 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
4719
4719
cond , _ = cond .align (self , join = 'right' , broadcast_axis = 1 )
4720
4720
else :
4721
4721
if not hasattr (cond , 'shape' ):
4722
- raise ValueError ('where requires an ndarray like object for '
4723
- 'its condition' )
4722
+ cond = np .asanyarray (cond )
4724
4723
if cond .shape != self .shape :
4725
4724
raise ValueError ('Array conditional must be same shape as '
4726
4725
'self' )
@@ -4878,26 +4877,20 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
4878
4877
4879
4878
Parameters
4880
4879
----------
4881
- cond : boolean %(klass)s, array or callable
4880
+ cond : boolean %(klass)s, array-like, or callable
4882
4881
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).
4886
4884
4887
4885
.. versionadded:: 0.18.1
4888
4886
4889
- A callable can be used as cond.
4890
-
4891
4887
other : scalar, %(klass)s, or callable
4892
4888
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).
4896
4891
4897
4892
.. versionadded:: 0.18.1
4898
4893
4899
- A callable can be used as other.
4900
-
4901
4894
inplace : boolean, default False
4902
4895
Whether to perform the operation in place on the data
4903
4896
axis : alignment axis if needed, default None
0 commit comments