Skip to content

ak.abs to handle uint64 #5247

@ajpotts

Description

@ajpotts

ak.abs to handle uint64. Right now it errors out:

In [9]: x = ak.arange(10,dtype=ak.uint64)

In [10]: ak.abs(x)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[10], line 1
----> 1 ak.abs(x)

File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/__init__.py:891, in typechecked.<locals>.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)
    894 # If a generator is returned, wrap it if its yield/send/return types can be checked

File ~/git/arkouda/arkouda/numpy/numeric.py:374, in abs(pda)
    345 """
    346 Return the element-wise absolute value of the array.
    347 
   (...)    370 2.00000000... 1.00000000...])
    371 """
    372 from arkouda.client import generic_msg
--> 374 repMsg = generic_msg(
    375     cmd=f"abs<{pda.dtype},{pda.ndim}>",
    376     args={
    377         "pda": pda,
    378     },
    379 )
    380 return create_pdarray(repMsg)

File ~/git/arkouda/arkouda/client.py:1154, in generic_msg(cmd, args, payload, send_binary, recv_binary)
   1152     else:
   1153         assert payload is None
-> 1154         return cast(Channel, channel).send_string_message(
   1155             cmd=cmd, args=msg_args, size=size, recv_binary=recv_binary
   1156         )
   1157 except KeyboardInterrupt as e:
   1158     # Reset the socket before re-raising to keep the REQ/REP stream in sync.
   1159     cast(Channel, channel).connect(timeout=0)

File ~/git/arkouda/arkouda/client.py:575, in ZmqChannel.send_string_message(self, cmd, recv_binary, args, size, request_id)
    573 # raise errors or warnings sent back from the server
    574 if return_message.msgType == MessageType.ERROR:
--> 575     raise RuntimeError(return_message.msg)
    576 elif return_message.msgType == MessageType.WARNING:
    577     warnings.warn(return_message.msg)

RuntimeError: Unrecognized command: abs<uint64,1>

In [11]: y = ak.arange(10,dtype=ak.int64)

In [12]: ak.abs(y)
Out[12]: array([0 1 2 3 4 5 6 7 8 9])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions