How to save numpy array

0 votes

Hi Guys,

I am new to the NumPy module. I have one array in NumPy. I want to save this array for future use. How can I do this?

Jun 22, 2020 in Python by akhtar
• 38,170 points
359 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use numpy.save() function to save your array. It stores the input array in a disk file with npy extension. I have attached one example below.

import numpy as np 
a = np.array([1,2,3,4,5]) 
np.save('outfile',a)

I hope this will help.

answered Jun 22, 2020 by MD
• 95,060 points

Related Questions In Python

0 votes
1 answer

How to save Numpy array as image in python?

If you have matplotlib, you can do: import ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,520 points
6,896 views
0 votes
1 answer
0 votes
1 answer

How to create Pandas series from numpy array?

Hi. Refer to the below command: import pandas ...READ MORE

answered Apr 1, 2019 in Python by Pavan
1,517 views
0 votes
1 answer

How to convert pandas dataframe to numpy array?

Irrespective of whether the dataframe has similar ...READ MORE

answered May 12, 2019 in Python by Rishi
5,698 views
0 votes
1 answer
0 votes
1 answer

Doubt in numpy.vstack

The vstack function in numpy will stack ...READ MORE

answered Jul 30, 2019 in Python by Esha
276 views
0 votes
1 answer
0 votes
1 answer

How to load Numpy array in Jupyter Notebook?

Hi@akhtar, You can use numpy.load() function to load ...READ MORE

answered Jun 22, 2020 in Python by MD
• 95,060 points
1,226 views
+1 vote
1 answer

How to save graph using matplotlib library?

Hi@akhtar, You can find one function called savefig ...READ MORE

answered May 21, 2020 in Python by MD
• 95,060 points
404 views