Skip to content

bug in pd.array when dtype is ak.bigint #5413

@ajpotts

Description

@ajpotts

bug in pd.array when dtype is ak.bigint

In [20]: a = ak.array(np.array([0, -1, 2]), dtype="bigint")

In [21]: b = pd.array(a, dtype="ak.bigint")
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[21], line 1
----> 1 b = pd.array(a, dtype="ak.bigint")

File ~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/pandas/core/construction.py:326, in array(data, dtype, copy)
    324 if isinstance(dtype, ExtensionDtype):
    325     cls = dtype.construct_array_type()
--> 326     return cls._from_sequence(data, dtype=dtype, copy=copy)
    328 if dtype is None:
    329     was_ndarray = isinstance(data, np.ndarray)

File ~/git/arkouda/arkouda/pandas/extension/_arkouda_array.py:125, in ArkoudaArray._from_sequence(cls, scalars, dtype, copy)
    122     dtype = dtype.numpy_dtype
    124 # If scalars is already a numpy array, we can preserve its dtype
--> 125 return cls(ak_array(scalars, dtype=dtype, copy=copy))

File ~/git/arkouda/arkouda/numpy/pdarraycreation.py:319, in array(a, dtype, copy, max_bits, unsafe, any_neg, num_bits)
    317 # If a is already a pdarray, do nothing
    318 if isinstance(a, pdarray):
--> 319     casted = akcast(a, dtype)  # the "dtype is None" case was covered above
    320     if isinstance(casted, pdarray) and dtype == bigint and max_bits != -1:
    321         casted.max_bits = max_bits

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:323, in cast(pda, dt, errors)
    320     else:
    321         dt = akdtype(dt)
    322         return create_pdarray(
--> 323             generic_msg(
    324                 cmd=f"cast<{pda.dtype},{dt},{pda.ndim}>",
    325                 args={"name": pda},
    326             )
    327         )
    328 elif isinstance(pda, Strings):
    329     if dt is Categorical or dt == "Categorical":

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

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

RuntimeError: Unrecognized command: cast<bigint,object,1>


Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions