Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: add explanation of dtype to parameter values for np.append #26303

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

Merged
merged 6 commits into from
Apr 22, 2024

Conversation

tuhinsharma121
Copy link
Contributor

Improve doc strings to include explanation of dtype to parameter values for np.append

closes #26291

@tuhinsharma121
Copy link
Contributor Author

@rkern @seberg I took a first stab at it. I need your guidance here.

@tuhinsharma121
Copy link
Contributor Author

install pkg-config is failing. I dont think its happening due to my code changes.

@tuhinsharma121 tuhinsharma121 force-pushed the np-append-documentation-enhancement branch from 2a7c235 to 1807e08 Compare April 18, 2024 09:22
@tuhinsharma121
Copy link
Contributor Author

all right. tests have passed now.

@tuhinsharma121
Copy link
Contributor Author

This PR is ready for review

cc @rkern @seberg

Comment on lines 5718 to 5719
flattened before use. If dtype of values is different from the
dtype of arr then their dtypes are compared to figure out the
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flattened before use. If dtype of values is different from the
dtype of arr then their dtypes are compared to figure out the
flattened before use. If dtype of `values` is different from the
dtype of `arr` then their dtypes are compared to figure out the

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed now.

@mattip
Copy link
Member

mattip commented Apr 19, 2024

Please add [skip azp][skip cirrus][skip actions] to the commit message to only run the circleci documentation CI job.

@tuhinsharma121
Copy link
Contributor Author

Please add [skip azp][skip cirrus][skip actions] to the commit message to only run the circleci documentation CI job.

Thank you for pointing. Done.

@tuhinsharma121
Copy link
Contributor Author

@mattip Please let me know if any more changes need to be done.

@mattip
Copy link
Member

mattip commented Apr 21, 2024

I think this does not actually address the issue that prompted the PR, which was that calling np.append(np.array([1]), np.array([])) will result in a float64 array, not an int one. The change here makes sense, but could be added to pretty much every function that mixes two ndarrays. The special thing in the issue is that an empty array will have dtype=float64. Can you think of a way to document that special case? Maybe adding a Note, or an Example?

@tuhinsharma121 tuhinsharma121 marked this pull request as draft April 21, 2024 03:56
@tuhinsharma121 tuhinsharma121 marked this pull request as ready for review April 21, 2024 04:08
Copy link
Member

@mattip mattip left a comment

Choose a reason for hiding this comment

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

A few comments, what do you think?

>>> c.dtype
float64

Default dtype for empty lists is `float64` thus making the output of dtype
Copy link
Member

Choose a reason for hiding this comment

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

Move this comment to above the example

Suggested change
Default dtype for empty lists is `float64` thus making the output of dtype
Default dtype for empty ndarrays is `float64` thus making the output of dtype

@tuhinsharma121 tuhinsharma121 marked this pull request as draft April 22, 2024 05:37
@tuhinsharma121 tuhinsharma121 marked this pull request as ready for review April 22, 2024 05:47
@mattip mattip merged commit 8a6ef43 into numpy:main Apr 22, 2024
4 checks passed
@mattip
Copy link
Member

mattip commented Apr 22, 2024

Thanks @tuhinsharma121

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.

DOC: np.append docs should explain how appending different dtypes works
2 participants