Skip to content

DOC: Document that ufuncs don't work on structured/record arrays - #32838

Merged
InessaPawson merged 2 commits into
numpy:mainfrom
sukeyzhou:ufuncs
Oct 9, 2026
Merged

InessaPawson merged 2 commits into
numpy:mainfrom
sukeyzhou:ufuncs

Conversation

@sukeyzhou

Copy link
Copy Markdown
Contributor

PR summary

Document that ufuncs don't work on structured/record arrays. Closes #24585.
This PR updates the structured arrays user guide and the recarray docstring.

First time contributor introduction

I work in web acquisition and use pandas in my work. This is my first NumPy PR.
I picked up the issue from the NumFOCUS Series Issue Tracker.

AI Disclosure

  • Tool: Claude Code (Claude Opus 5.5)
  • AI drafted the text in both files.
  • AI also ran tests to confirm the error behavior and checked the documentation links.
  • I reviewed the changes myself and ran spin docs.

@seberg seberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for attacking this! It feels like one of those slightly more complicated doc ones to get the amount of detail right that is helpful to most users.

Maybe the angle that we can fit in somehow is that NumPy doesn't define most functions to operate on all fields at the same time. Even == and != don't operate per-field. And because of that you always must work with individual fields to e.g. do math.

Comment thread doc/source/user/basics.rec.rst Outdated
Comment thread doc/source/user/basics.rec.rst Outdated
Comment thread numpy/_core/records.py Outdated
@InessaPawson InessaPawson added the sustain-2026 Issues reserved for NumFOCUS Sustaining Open Source Series 2026 label Oct 2, 2026
@InessaPawson
InessaPawson requested a review from seberg October 2, 2026 19:43
@InessaPawson InessaPawson moved this from Open to Needs Review in NF Sustaining Open Source Series 2026 Oct 2, 2026

@seberg seberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM and fixes the incorrect note. Will wait a bit in case someone wants to chime in or has a thought.

@InessaPawson
InessaPawson merged commit 70fa998 into numpy:main Oct 9, 2026
89 of 91 checks passed
@InessaPawson

Copy link
Copy Markdown
Member

The two CI failures (custom_checks) are unrelated to this PR. Merging.

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

Labels

04 - Documentation sustain-2026 Issues reserved for NumFOCUS Sustaining Open Source Series 2026

Projects

Development

Successfully merging this pull request may close these issues.

ufuncs don't work on recarray

3 participants