hgrecco / pint

Operate and manipulate physical quantities in Python
http://pint.readthedocs.org/
Other
2.4k stars 469 forks source link

Preserve column/row ndarry representation in Jupyter notebooks #487

Open pylang opened 7 years ago

pylang commented 7 years ago

Can we preserve the column, row representation for numpy arrays? Right now it prints as a flat list. Example:

Numpy

>>> a = np.asarray([[1, 2], [3, 4]])
>>> a
array([[1, 2],
       [3, 4]])

Numpy + Pint

>>> import pint
>>>u = pint.UnitRegistry()
>>>a * u.m
[[1 2] [3 4]] meter

Desired

array([[1, 2],
       [3, 4]]) meter

I am not particular on whether is says "array" or "Quantity"., but the col/rows make reading easier for very large arrays. If not, I would like to see the original representation before the units were applied.

hgrecco commented 7 years ago

Let's try to make it happen for 0.8

hgrecco commented 7 years ago

Moving this to 0.9