[Ajout] J'ai écrit un mémo comme celui-ci quand j'étais étudiant, mais s'il vous plaît, utilisez calmement `` np.concatenate```: https://docs.scipy.org/doc/numpy/reference /generated/numpy.concatenate.html
Faites une note car j'oublie souvent lequel.
>>> import numpy as np
>>> a = np.array([[1,2,3], [4,5,6]])
>>> b = np.array([[7, 8, 9], [10, 11, 12]])
>>> c = np.array((1, 2, 3))
>>> d = np.array((4, 5, 6))
>>> a
array([[1, 2, 3],
[4, 5, 6]])
>>> b
array([[ 7, 8, 9],
[10, 11, 12]])
>>> c
array([1, 2, 3])
>>> d
array([4, 5, 6])
>>> np.r_[a, b]
array([[ 1, 2, 3],
[ 4, 5, 6],
[ 7, 8, 9],
[10, 11, 12]])
>>> np.c_[a, b]
array([[ 1, 2, 3, 7, 8, 9],
[ 4, 5, 6, 10, 11, 12]])
>>> np.r_[c, d]
array([1, 2, 3, 4, 5, 6])
>>> np.c_[c, d]
array([[1, 4],
[2, 5],
[3, 6]])
Recommended Posts