Skip to main content

A Python package which provides tools to convert files to and from IDX format (described at into numpy.ndarray.

Project description


idx2numpy package provides a tool for converting files to and from
IDX format to numpy.ndarray. You can meet files in IDX format,
e.g. when you're going to read the [MNIST database of handwritten digits]( provided by Yann LeCun.

The description of IDX format also can be found on this page.

[![Build Status](](


The easiest way to install is by using pip to pull it from PyPI:

pip install idx2numpy

You can also clone the Git repository from Github and install
the package manually:

git clone
python install


import idx2numpy

# Reading
ndarr = idx2numpy.convert_from_file('myfile.idx')

f_read = open('myfile.idx', 'rb')
ndarr = idx2numpy.convert_from_file(f_read)

s =
ndarr = idx2numpy.convert_from_string(s)

# Writing
idx2numpy.convert_to_file('myfile_copy.idx', ndarr)

f_write = open('myfile_copy2.idx', 'wb')
idx2numpy.convert_to_file(f_write, ndarr)

s = convert_to_string(ndarr)

Authors and Contributors
The project is started and maintained by Ivan Yurchenko
The Contributors are:
* [andres-s](
* [angeloskath](
* [piercefreeman](

MIT license (see *LICENSE* file)


Please, send me a feedback about the library, such as bugs, use cases etc.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for idx2numpy, version 1.2.2
Filename, size File type Python version Upload date Hashes
Filename, size idx2numpy-1.2.2.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page