Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of recarray #26687

Merged
merged 1 commit into from Sep 14, 2023
Merged

Remove usage of recarray #26687

merged 1 commit into from Sep 14, 2023

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Sep 4, 2023

Structured numpy arrays are more fundamental than recarrays and sufficient in all cases.

Superseeds #26664.

@timhoffm timhoffm force-pushed the remove-recarray branch 2 times, most recently from 75186cd to d4599b4 Compare September 4, 2023 01:17
# `pandas.DataFrame`. Matplotlib allows you to provide the ``data`` keyword argument
# and generate plots passing the strings corresponding to the *x* and *y* variables.
#
# .. _structured numpy array: https://numpy.org/doc/stable/user/basics.rec.html#structured-arrays
Copy link
Member

Choose a reason for hiding this comment

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

This link is in-lined above and causing a flake8 flag

Suggested change
# .. _structured numpy array: https://numpy.org/doc/stable/user/basics.rec.html#structured-arrays

Copy link
Member

Choose a reason for hiding this comment

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

(alternatively we could add this file to the flake8 config ignores)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to except the whole file from flake8. That's why I've inlined the links. Alternatively, we could use an inline comment # noqa: E501 on the links, which we generally don't do, but seems ok in this case.

@QuLogic
Copy link
Member

QuLogic commented Sep 5, 2023

Superseeds #26664.

Note, it's spelled 'supersedes', but also, it's not one of the valid keywords if that's what you were intending.

@ksunden
Copy link
Member

ksunden commented Sep 5, 2023

Note, it's spelled 'supersedes'

This always gets me, too, though I tend to think it should be spelled "supercedes" as in "cause the other one to cede to it"... or as opposed to "precede" etc.


# Highlight gaps in daily data
gaps = np.flatnonzero(np.diff(r.date) > np.timedelta64(1, 'D'))
gaps = np.flatnonzero(np.diff(r["date"]) > np.timedelta64(1, 'D'))
for gap in r[['date', 'adj_close']][np.stack((gaps, gaps + 1)).T]:
ax1.plot(gap.date, gap.adj_close, 'w--', lw=2)
Copy link
Member

Choose a reason for hiding this comment

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

This one is a copy of r that hasn't been changed.

Suggested change
ax1.plot(gap.date, gap.adj_close, 'w--', lw=2)
ax1.plot(gap['date'], gap['adj_close'], 'w--', lw=2)

Structured numpy arrays are more fundamental than recarrays
and sufficient in all cases.

Supersedes matplotlib#26664.
@QuLogic QuLogic added this to the v3.8.0 milestone Sep 14, 2023
@QuLogic QuLogic merged commit 8fdae3b into matplotlib:main Sep 14, 2023
19 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 14, 2023
QuLogic added a commit that referenced this pull request Sep 14, 2023
…687-on-v3.8.x

Backport PR #26687 on branch v3.8.x (Remove usage of recarray)
@timhoffm timhoffm deleted the remove-recarray branch September 14, 2023 20:40
@ksunden ksunden mentioned this pull request Sep 15, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants