How to YAML save numpy array
numpy, python, save, yaml
Solution
In [24]: matrix = np.random.randint(2, size=(3,4))
In [25]: np.save('test', matrix)
In [26]: a = np.load('test.npy')
In [27]: matrix
Out[27]:
array([[0, 1, 1, 1],
[1, 0, 1, 1],
[1, 1, 1, 1]])
In [28]: a
Out[28]:
array([[0, 1, 1, 1],
[1, 0, 1, 1],
[1, 1, 1, 1]])
Problem
Hi is there a way how to save numpy 2D array and then safely load it from a file? I have this array: ``` matrix = np.random.randint(2, size=(self.row,self.col)) ``` But I´m unable to save it