Sha256: 89c393ff3926bda5350b8d52017daa6808d56ad14e75f9978a621a0f422c5beb

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# Npy

Load NumPy `npy` and `npz` files in Ruby - no Python required

:fire: Uses [Numo::NArray](https://github.com/ruby-numo/numo-narray) for blazing performance

## Installation

Add this line to your application’s Gemfile:

```ruby
gem 'npy'
```

## Getting Started

### npy

`npy` files contain a single array

Load an `npy` file

```ruby
arr = Npy.load("x.npy")
```

Load an `npy` string

```ruby
byte_str = File.binread("x.npy")
arr = Npy.load_string(byte_str)
```

### npz

`npz` files contain multiple arrays

Load an `npz` file

```ruby
arrs = Npy.load_npz("mnist.npz")
```

Get keys

```ruby
arrs.keys
```

Get an array

```ruby
arrs["x"]
```

Arrays are lazy loaded for performance

## Resources

- [npy format](https://docs.scipy.org/doc/numpy/reference/generated/numpy.lib.format.html#module-numpy.lib.format)

## History

View the [changelog](https://github.com/ankane/npy/blob/master/CHANGELOG.md)

## Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

- [Report bugs](https://github.com/ankane/npy/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/npy/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
npy-0.1.0 README.md