save data as npz file python

Solutions on MaxInterview for save data as npz file python by the best coders in the world

showing results for - "save data as npz file python"
Matteo
11 Apr 2020
1# save numpy array as npy file
2from numpy import asarray
3from numpy import save
4# define data
5data = asarray([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])
6# save to npy file
7save('data.npy', data)
8
9# load numpy array from npy file
10from numpy import load
11# load array
12data = load('data.npy')
13# print the array
14print(data)