Skip to main content

Display numpy ndarrays in a pretty table in Jupyter notebooks

Project description

ndpretty

Your little helper to display numpy ndarrays in a pretty table in Jupyter notebooks.

Jupyter notebooks are a great way to develop. ndpretty makes it even better for people who use numpy by providing nice formatting of ndarrays.

Open In Colab

Install

pip install ndpretty

How to use

import ndpretty
import numpy as np

Display an ndarray using ndarray_html():

ndpretty.ndarray_html(np.random.rand(3, 4))

If you want all np.ndarrays and torch.Tensors to be automatically formatted like this, load the default configuration:

ndpretty.default()

After this line has been exectued, all cell outputs that are np.ndarray or torch.Tensor are automatically formatted by ndpretty.

a = np.random.rand(10, 5)
a
10×5 float64 ndarray

It works with all numpy dtypes, multi-dimensional arrays and PyTorch tensors.

Find more usage examples here.

Why?

Look at the alternatives.

Author

Patrick Deutschmann (patrick@deutschmann.xyz)

Project details


Download files

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

Source Distribution

ndpretty-0.0.7.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

ndpretty-0.0.7-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page