Skip to content

Commit c016301

Browse files
DOC: added one example with mixed dtype [skip azp][skip cirrus][skip actions]
1 parent 1dbc253 commit c016301

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

numpy/lib/_function_base_impl.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,13 +5746,22 @@ def append(arr, values, axis=None):
57465746
array([[1, 2, 3],
57475747
[4, 5, 6],
57485748
[7, 8, 9]])
5749+
57495750
>>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0)
57505751
Traceback (most recent call last):
57515752
...
57525753
ValueError: all the input arrays must have same number of dimensions, but
57535754
the array at index 0 has 2 dimension(s) and the array at index 1 has 1
57545755
dimension(s)
57555756
5757+
>>> a = np.array([1, 2], dtype=int)
5758+
>>> b = []
5759+
>>> np.append(a, b)
5760+
array([1., 2.])
5761+
5762+
Default dtype for empty lists is `float64` thus making the output of dtype
5763+
`float64` when appended with dtype `int64`
5764+
57565765
"""
57575766
arr = asanyarray(arr)
57585767
if axis is None:

0 commit comments

Comments
 (0)