filmov
tv
How To Concatenate NumPy Arrays | NumPy Joining Array | NumPy v1.26 Manual

Показать описание
The axis parameter specifies the axis along which the arrays will be concatenated. If the axis parameter is None, then the arrays will be flattened before being concatenated.
Here is an example of how to concatenate two NumPy arrays along the axis 0:
Python
import numpy as np
print(c)
Use code with caution. Learn more
Output:
[1 2 3 4 5 6]
You can also concatenate NumPy arrays along other axes. For example, to concatenate two NumPy arrays along the axis 1, you would use the following code:
Python
import numpy as np
print(c)
Use code with caution. Learn more
Output:
[[1 2 5 6]
[3 4 7 8]]
Python
import numpy as np
print(d)
Use code with caution. Learn more
Output:
[1 2 3 4 5 6 7 8 9]