Skip to content

Commit 61fd93c

Browse files
committed
Add README.md
1 parent e7378b7 commit 61fd93c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ReadNumPy
2+
3+
ReadNumPy is a package that allows to read NPY files using Mathematica.
4+
So far it supports only numeric data types, NPY version 1.0 and it does not support arrays stored in Fortran order (i.e. column major order).
5+
However I'm planning to add support for NPY 2.0.
6+
7+
### Usage
8+
9+
Python:
10+
11+
>>> import numpy as np
12+
>>> arr = np.random.random((2, 3, 2))
13+
>>> np.save('arr.npy', arr)
14+
>>> arr
15+
>>> array([[[0.56722277, 0.47052153],
16+
[0.27949656, 0.02174664],
17+
[0.01491723, 0.46984945]],
18+
19+
[[0.18369629, 0.23657315],
20+
[0.00243881, 0.80721822],
21+
[0.56594514, 0.94332137]]])
22+
23+
Mathematica:
24+
25+
In[1]:= << NumPyArray`
26+
In[2]:= ReadNumPyArray["arr.npy"]
27+
Out[2]:= {{{0.567223, 0.470522}, {0.279497, 0.0217466}, {0.0149172, 0.469849}}, {{0.183696, 0.236573}, {0.00243881, 0.807218}, {0.565945, 0.943321}}}

0 commit comments

Comments
 (0)