It is often used for label data in machine learning. There will be a faster way to write
python
>>> import numpy as np
>>> y = np.array([[1], [1], [0], [1], [0]])
>>> y
array([[1],
[1],
[0],
[1],
[0]])
>>> z = np.array([x for x in y])
>>> z
array([1, 1, 0, 1, 0])
Recommended Posts