saveAsNpy

Syntax

saveAsNpy(obj, fileName)

Arguments

obj is a numeric vector/matrix.

fileName is the path and name of the output file.

Details

Save a vector/matrix in DolphinDB as an npy file. It must be executed by a logged-in user.

NULL in a DolphinDB variable will be converted into NaN in the npy file.

Examples

$ v = 1..1000
$ v.saveAsNpy("C:/DolphinDB/intVec.npy")

$ m = (1..1000 + 0.5)$20:50
$ m.saveAsNpy("C:/DolphinDB/doubleMat.npy")

Load files in python:

import numpy as np
v = np.load("C:/DolphinDB/intVec.npy")
m = np.load("C:/DolphinDB/doubleMat.npy")

Related function: loadNpy