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

DOC: Fix reference warning for recarray. #24152

Merged
merged 1 commit into from
Aug 3, 2023
Merged

Conversation

liang3zy22
Copy link
Contributor

@liang3zy22 liang3zy22 commented Jul 10, 2023

This is to fix reference warning for module numpy.rec. Put it in draft since I am not sure about current solution.
@rossbar , Please give comment. My current solution is add a new section for "record arrays" just after "masked arrays".
Do you think it is reasonable? If yes, I can add related content in "record arrays" section.

@liang3zy22 liang3zy22 marked this pull request as draft July 10, 2023 07:41
Copy link
Member

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

Nitpick: if we're adding this to this page, should we organize these submodules alphabetically so that we have

np.char
np.ma
np.rec

?

@liang3zy22
Copy link
Contributor Author

Nitpick: if we're adding this to this page, should we organize these submodules alphabetically so that we have

np.char
np.ma
np.rec

?

I put it after 'masked arrays' since they are both array objects and masked arrays are used more. I am not sure they should be alphabetically listed.

@liang3zy22 liang3zy22 marked this pull request as ready for review July 21, 2023 02:15
Copy link
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

Generally +1 for creating the recarray article for the refguide. I'm hesitant about exposing it in the array refguide article though, as I don't think recarrays should be used in new code (e.g. pandas is preferrable for tabular data).

@@ -45,5 +45,6 @@ of also more complicated arrangements of data.
arrays.nditer
arrays.classes
maskedarray
recordarray
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd vote to remove the mention from the top-level array refguide article, just because I don't think recarrays are recommended for new code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be removed. But a "document isn't included in any toctree" warning will be raised. I don't think adding it into routines.rst is a better choice.

@mattip
Copy link
Member

mattip commented Aug 2, 2023

Aren't they syntactical sugar over structured arrays to allow access by attribute rather than key? If so, I don't think they are so bad. Maybe the new reference could mention that pandas data frames are much more powerful.

@liang3zy22
Copy link
Contributor Author

Aren't they syntactical sugar over structured arrays to allow access by attribute rather than key? If so, I don't think they are so bad. Maybe the new reference could mention that pandas data frames are much more powerful.

I added a note to use pandas DataFrame instead.

@mattip
Copy link
Member

mattip commented Aug 2, 2023

Sorry I didn't investigate this more closely before getting involved. What is the exact warning you see?

It seems rec array (and masked array) is already rendered under the arrays.classes heading two lines above. See the rendered page of arrays.rst. So maybe is would be better to remove both references, and improve the reference in the array subclasses page, arrays.classes.rst to avoid the warning, if possible, rather than adding a new page.

@liang3zy22
Copy link
Contributor Author

liang3zy22 commented Aug 2, 2023

Sorry I didn't investigate this more closely before getting involved. What is the exact warning you see?

It seems rec array (and masked array) is already rendered under the arrays.classes heading two lines above. See the rendered page of arrays.rst. So maybe is would be better to remove both references, and improve the reference in the array subclasses page, arrays.classes.rst to avoid the warning, if possible, rather than adding a new page.

You mean remove numpy.rec module completely? The warning I met is:
numpy/doc/source/reference/recordarray.rst: WARNING: document isn't included in any toctree

I think we can improve _arrays.classes.rec part, let routines.array-creation.rec part refer to _arrays.classes.rec part. And remove numpy.rec module reference from these two parts.

@mattip
Copy link
Member

mattip commented Aug 2, 2023

The warning I met is:

numpy/doc/source/reference/recordarray.rst: WARNING: document isn't included in any toctree

I mean the original warning, before this PR.

@liang3zy22
Copy link
Contributor Author

The warning is:

arrays.classes.rst:514: WARNING: py:mod reference target not found: numpy.rec
routines.array-creation.rst:47: WARNING: py:mod reference target not found: numpy.rec
routines.array-creation.rst:50: WARNING: py:mod reference target not found: numpy.rec

@mattip
Copy link
Member

mattip commented Aug 2, 2023

Then yes, this

Let routines.array-creation.rec part refer to _arrays.classes.rec part. And remove numpy.rec module reference from these two parts.

I think would be a better solution.

@mattip
Copy link
Member

mattip commented Aug 3, 2023

here and here are the rendered changed pages. LGTM

@mattip mattip merged commit f0befec into numpy:main Aug 3, 2023
50 of 51 checks passed
@mattip
Copy link
Member

mattip commented Aug 3, 2023

Thanks @liang3zy22

@liang3zy22 liang3zy22 deleted the recarray branch August 3, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants