read-npy-file
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

read-npy-file

Install

npm i read-npy-file

Usage

import readNumpyFile from 'read-npy-file'
const dataArray = readNumpyFile('data.npy')
console.log(
    {
        // The DataArray result
        dataArray,
        // 'typedArray' is a TypedArray. see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
        typedArray: dataArray.typedArray,
        // The shape of the numpy array
        shape: dataArray.shape,
        // Converts the flat TypedArray into a nested normal array equivalent to what it would be in python.
        array: dataArray.toArray(),
        // Converts to json string.
        json: dataArray.toJson(),
    }
)

Package Sidebar

Install

npm i read-npy-file

Weekly Downloads

7

Version

1.0.4

License

ISC

Unpacked Size

16.4 kB

Total Files

6

Last publish

Collaborators

  • nicholastancredi