简体   繁体   中英

Saving large numpy arrays using Python

I have a dataframe with only two columns, one is text and one is with numpy array values, which can have more than 170000 elements. The problem is how to save this large numpy arrays as files, so I can load them back later. When trying to save as CVS, it just saves it as a short string, loosing the real values:

[-8.0152120e-07  2.8887976e-05  3.3898741e-05 ... -1.3205040e-01
 -9.4032057e-02  0.0000000e+00]

I thought maybe to save as text one by one, but is there any elegant way to do this?

As suggested, you can save it as a numpy file using np.save . Later you can load it using np.load .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM