loadNpy

Syntax

loadNpy(fileName)

Arguments

filename is a string indicating the path and name of an NPY file.

Details

Load an NPY (Python Numpy) binary file and convert it into a DolphinDB vector or matrix. NaN in the NPY file is converted into NULL in DolphinDB.

Right now the function only works for NPY files with numerical data.

Examples

Save NPY files in Python:

import numpy as np
np.save("intVec.npy", np.array([5,6,1,3,4,8]))
np.save("doubleMat.npy", np.array([[1.5,5.6,-7.87],[-1.0,3.4,4.5]]))

Load NPY files in DolphinDB:

$ loadNpy("intVec.npy");
[5,6,1,3,4,8]

$ loadNpy("doubleMat.npy");

#0

#1

#2

1.5

5.6

-7.87

-1

3.4

4.5

Related function: saveAsNpy