When there is an array of two rows and three columns called gird = np.array ([[1, 2, 3, [4, 5, 6])
If you do np.concatenate ([gird, grid], axis=1), Why is the result
array([[1, 2, 3, 1, 2, 3], [4, 5, 6, 4, 5, 6] Does it work like this?
I think array([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6] I think it should be like this
python numpy concatenation
concatenate
according to the numpy document:
Join a sequence of arrays along an existing axis.
(Interpretation) Join each array along axis.
Therefore
Therefore, np.concatenate ([grid, grid], axis=1)
joins the sequence based on axis = 1. Illustrated as follows:
array ([[[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]]) If you want to make a
array ([1, 2, 3, 4, 5, 6]), I think you should use stacks, not join.
flatten_grid = grid.flatten()
np.array([flatten_grid, flatten_grid])
np.stack((flatten_grid, flatten_grid))
750 Error in x, y, and format string must not be None
1225 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
764 M2 Mac fails to install rbenv install 3.1.3 due to errors
633 PHP ssh2_scp_send fails to send files as intended
768 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2025 OneMinuteCode. All rights reserved.