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.
pip install ndpretty
import ndpretty
import numpy as npDisplay 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)
a10×5 float64 ndarray
It works with all numpy dtypes, multi-dimensional arrays and PyTorch tensors.
Find more usage examples here.
Look at the alternatives.
Patrick Deutschmann (patrick@deutschmann.xyz)

