8000 DOC: add explanation of dtype to parameter values for np.append by tuhinsharma121 · Pull Request #26303 · numpy/numpy · GitHub
[go: up one dir, main page]

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
Prev Previous commit
Next Next commit
DOC: added Notes section to document mixed dtype effect on np.append …
…[skip azp][skip cirrus][skip actions]
  • Loading branch information
tuhinsharma121 committed Apr 21, 2024
commit 04890824f0d1d2de70947ed8185b0760e882cac0
12 changes: 8 additions & 4 deletions numpy/lib/_function_base_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5715,10 +5715,7 @@ def append(arr, values, axis=None):
These values are appended to a copy of `arr`. It must be of the
correct shape (the same shape as `arr`, excluding `axis`). If
`axis` is not specified, `values` can be any shape and will be
flattened before use. If dtype of `values` is different from the
dtype of `arr` then their dtypes are compared to figure out the
common dtype they can both be safely coerced to. For e.g. `int64`
and `float64` can both go to `float64`.
flattened before use.
axis : int, optional
The axis along which `values` are appended. If `axis` is not
given, both `arr` and `values` are flattened before use.
Expand All @@ -5735,6 +5732,13 @@ def append(arr, values, axis=None):
insert : Insert elements into an array.
delete : Delete elements from an array.

Notes
-----
If dtype of `values` is different from the dtype of `arr` then
their dtypes are compared to figure out the common dtype they can
both be safely coerced to. For e.g. `int64` and `float64` can both
go to `float64`. See examples section below.

Examples
--------
>>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]])
Expand Down
0