Skip to content

where to allow bool_scalars #5373

Closed

Description

@ajpotts

ak.where to allow bool_scalars for arguments A and B.

Activity

  1. self-assigned this
    on Jan 29, 2026
  2. ajpotts commented on Jan 29, 2026

    @ajpotts
    ContributorAuthor

    This example shows how NumPy and arkouda differ:

    
    In [4]: np.where(True, True,False)
    Out[4]: array(True)
    
    In [5]: ak.where(True,True,False)
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    Cell In[5], line 1
    ----> 1 ak.where(True,True,False)
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:890, in typechecked.<locals>.wrapper(*args, **kwargs)
        888 def wrapper(*args, **kwargs):
        889     memo = _CallMemo(python_func, _localns, args=args, kwargs=kwargs)
    --> 890     check_argument_types(memo)
        891     retval = func(*args, **kwargs)
        892     check_return_type(retval, memo)
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:748, in check_argument_types(memo)
        746             check_type(description, value, expected_type, memo)
        747         except TypeError as exc:  # suppress unnecessarily long tracebacks
    --> 748             raise exc from None
        750 return True
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:746, in check_argument_types(memo)
        744 description = 'argument "{}"'.format(argname)
        745 try:
    --> 746     check_type(description, value, expected_type, memo)
        747 except TypeError as exc:  # suppress unnecessarily long tracebacks
        748     raise exc from None
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:668, in check_type(argname, value, expected_type, memo, globals, locals)
        665             expected_type = (bytearray, bytes)
        667         if not isinstance(value, expected_type):
    --> 668             raise TypeError(
        669                 'type of {} must be {}; got {} instead'.
        670                 format(argname, qualified_name(expected_type), qualified_name(value)))
        671 elif isinstance(expected_type, TypeVar):
        672     # Only happens on < 3.6
        673     check_typevar(argname, value, expected_type, memo)
    
    TypeError: type of argument "condition" must be arkouda.numpy.pdarrayclass.pdarray; got bool instead
    
    In [6]: ak.where(True,ak.array([True,False]),False)
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    Cell In[6], line 1
    ----> 1 ak.where(True,ak.array([True,False]),False)
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:890, in typechecked.<locals>.wrapper(*args, **kwargs)
        888 def wrapper(*args, **kwargs):
        889     memo = _CallMemo(python_func, _localns, args=args, kwargs=kwargs)
    --> 890     check_argument_types(memo)
        891     retval = func(*args, **kwargs)
        892     check_return_type(retval, memo)
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:748, in check_argument_types(memo)
        746             check_type(description, value, expected_type, memo)
        747         except TypeError as exc:  # suppress unnecessarily long tracebacks
    --> 748             raise exc from None
        750 return True
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:746, in check_argument_types(memo)
        744 description = 'argument "{}"'.format(argname)
        745 try:
    --> 746     check_type(description, value, expected_type, memo)
        747 except TypeError as exc:  # suppress unnecessarily long tracebacks
        748     raise exc from None
    
    File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:668, in check_type(argname, value, expected_type, memo, globals, locals)
        665             expected_type = (bytearray, bytes)
        667         if not isinstance(value, expected_type):
    --> 668             raise TypeError(
        669                 'type of {} must be {}; got {} instead'.
        670                 format(argname, qualified_name(expected_type), qualified_name(value)))
        671 elif isinstance(expected_type, TypeVar):
        672     # Only happens on < 3.6
        673     check_typevar(argname, value, expected_type, memo)
    
    TypeError: type of argument "condition" must be arkouda.numpy.pdarrayclass.pdarray; got bool instead
    
    In [7]: np.where(True,np.array([True,False]),False)
    Out[7]: array([ True, False])
    
    
  3. added 3 commits that reference this issue on Jan 29, 2026
    1057ea4
    90da52f
    4cb285a
  4. added 7 commits that reference this issue on Feb 9, 2026
    4b375b6
    edfa2e4
    aa4cc80
    94248d4
    78843f6
    9fe4a5d
    361c42d
  5. added a commit that references this issue on Feb 11, 2026
    66c3e08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions