Skip to content

ufuncs don't work on recarray #24585

Description

@kwsp

Describe the issue:

np.recarray ufuncs don't work, even though they are documented. E.g. np.recarray.sum

Reproduce the code example:

x = np.array([(1.0, 2), (3.0, 4)], dtype=[('x', '<f8'), ('y', '<i8')])
x = x.view(np.recarray)
x.sum()  # Raises numpy.core._exceptions._UFuncNoLoopError

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\miniconda3\envs\oct\lib\site-packages\numpy\core\_methods.py", line 49, in _sum
    return umr_sum(a, axis, dtype, out, keepdims, initial, where)
numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype((numpy.record, [('x', '<f8'), ('y', '<i8')])), dtype((numpy.record, [('x', '<f8'), ('y', '<i8')]))) -> None

Runtime information:

1.25.2
3.10.8 | packaged by conda-forge | (main, Nov 24 2022, 14:07:00) [MSC v.1916 64 bit (AMD64)]

Context for the issue:

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    04 - Documentationsustain-2026Issues reserved for NumFOCUS Sustaining Open Source Series 2026

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions