https://github.com/dilawar/cnpy2
STL vector to numpy array (format 2)
https://github.com/dilawar/cnpy2
Last synced: about 2 months ago
JSON representation
STL vector to numpy array (format 2)
- Host: GitHub
- URL: https://github.com/dilawar/cnpy2
- Owner: dilawar
- Created: 2016-05-04T06:14:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-05T07:37:12.000Z (over 9 years ago)
- Last Synced: 2025-06-17T17:51:01.707Z (4 months ago)
- Language: C++
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cnpy2
This library writes a given STL vector of `double` of size N to a numpy ndarray
of shape = `( N/cols, cols)`. Two modes are supported:- Write mode "w" (the file will be overwritten)
- Append mode "a" (this will append the new data to npy file and modify the
haeder as well).## Use case
See file `example1.cpp`. In this example, I create a binary numpy file with 4
entries (2x2 shape), and then we append 100x100 entries in a for-loop.This writes to numpy format version 2 (record arrays). See the `test.py` file.
There is much more complete project https://github.com/rogersce/cnpy which
writes/reads your data to numpy version 1.