@@ -903,7 +903,14 @@ def __getitem__(self, idx):
903
903
self .idx = idx
904
904
return self
905
905
906
- def _common (self , at_op , y = _undef , mode : str = "promise_in_bounds" , ** kwargs ):
906
+ def _common (
907
+ self ,
908
+ at_op : str ,
909
+ y = _undef ,
910
+ copy : bool | None = True ,
911
+ mode : str = "promise_in_bounds" ,
912
+ ** kwargs ,
913
+ ):
907
914
"""Validate kwargs and perform common prepocessing.
908
915
909
916
Returns
@@ -1028,7 +1035,7 @@ def max(self, y, /, **kwargs):
1028
1035
xp = array_namespace (self .x )
1029
1036
return self ._iop ("max" , xp .maximum , y , ** kwargs )
1030
1037
1031
- def where (condition , x , y , / , copy : bool | None = True ):
1038
+ def where (condition , x = None , y = None , / , copy : bool | None = True ):
1032
1039
"""Return elements from x when condition is True and from y when
1033
1040
it is False.
1034
1041
@@ -1043,6 +1050,10 @@ def where(condition, x, y, /, copy: bool | None = True):
1043
1050
False
1044
1051
Raise ValueError if a copy cannot be avoided.
1045
1052
"""
1053
+ if x is None and y is None :
1054
+ xp = array_namespace (condition )
1055
+ return xp .where (condition )
1056
+
1046
1057
copy = _parse_copy_param (x , copy )
1047
1058
xp = array_namespace (condition , x , y )
1048
1059
if copy :
0 commit comments