numpy

Saving and loading of Arrays

Introduction#

Numpy arrays can be saved and loaded in various ways.

Using numpy.save and numpy.load

np.save and np.load provide a easy to use framework for saving and loading of arbitrary sized numpy arrays:

import numpy as np

a = np.random.randint(10,size=(3,3))
np.save('arr', a)

a2 = np.load('arr.npy')
print a2

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow