When two data processing functions primarily by
(1): np.save ( "test.npy ", the data structure) ---- stored data
(2): data = np.load ( 'test.npy ") - - fetch data
1, keep a list of
1 z = [[[1, 2, 3], ['w']], [[1, 2, 3], ['w']]] 2 np.save('test.npy', z) 3 x = np.load('test.npy') 4 5 x: 6 ->array([[list([1, 2, 3]), list(['w'])], 7 [list([1, 2, 3]), list(['w'])]], dtype=object)
2, stored dictionary
1 x 2 -> {0: 'wpy', 1: 'scg'} 3 np.save('test.npy',x) 4 x = np.load('test.npy') 5 x 6 ->array({0: 'wpy', 1: 'scg'}, dtype=object)
3. After saving a dictionary to read format, you need to call the following statement (emphasis !!!)
1 data.item()
Converting object data numpy.ndarray dict