Skip to content

Commit

Permalink
Merge pull request #2 from jonnor/npz-support
Browse files Browse the repository at this point in the history
Implement .npz support
  • Loading branch information
jonnor authored Sep 8, 2024
2 parents d3cba85 + c0219c8 commit 610f927
Show file tree
Hide file tree
Showing 5 changed files with 2,137 additions and 0 deletions.
Binary file added examples/digits/digits_combined.npz
Binary file not shown.
Binary file added examples/digits/digits_compressed.npz
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/digits/digits_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@

numpy.save('digits_data.npy', X)
numpy.save('digits_labels.npy', Y)

numpy.savez('digits_combined.npz', X=X, Y=Y)
numpy.savez_compressed('digits_compressed.npz', X=X, Y=Y)
17 changes: 17 additions & 0 deletions examples/digits/read_npz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

import zipfile
print('zipfile', zipfile.__file__)

import npyfile

path = 'examples/digits/digits_combined.npz'
with zipfile.ZipFile(path) as archive:

files = archive.namelist()
files = [ f for f in files if f.endswith('.npy') ]
print(files)

for name in files:
f = archive.open(name)
s, v = npyfile.load(f)
print('ss', s, len(v))
Loading

0 comments on commit 610f927

Please sign in to comment.