Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 641 Bytes

save-array-to-file.md

File metadata and controls

33 lines (24 loc) · 641 Bytes

How to save array to file

import numpy as np

array = np.array([1,2,3])
np.save('/tmp/numpy', array)
  • import numpy as np - load lib:Numpy module for Python
  • np.array - declare Numpy array
  • .save - save array to file
  • /tmp/numpy - path to file to save array to (file will have npy extension)
  • array - array to save to file

group: file

Example:

import numpy as np

array = np.array([1,2,3])
np.save('/tmp/numpy', array)

import os
print(os.path.getsize("/tmp/numpy.npy"))
152

link_youtube: https://youtu.be/ZSz44oaFkU0