[Numpy-discussion] numpy pprint?

Eric Wieser wieser.eric+numpy at gmail.com
Wed Nov 7 01:23:33 EST 2018


Foad:

having the functionality for conventional consols would also help

I think the most important thing in a conventional console is to output the
array in a format that allows you to reconstruct the object. That makes it
way easier for people to reproduce each others problems without having
their full dataset. If your goal is to visualize complex arrays, I think
the console is a pretty limited tool, and numpy already does as much as is
worthwhile there.

I don’t think putting everything in boxes is helping. it is confusing. I
would rather having horizontal and vertical square brackets represent each
nested array

See my update at the same link, which shows an alternative which draws
those brackets as you envi

it would be awesome if in IPython/Jupyter hovering over an element a popup
would show the index

It… already does?

to show L R U P or combination of these plus some numbers

I don’t know what you mean by this.

Eric

On Tue, 6 Nov 2018 at 00:56 Foad Sojoodi Farimani f.s.farimani at gmail.com
<http://mailto:f.s.farimani@gmail.com> wrote:

Wow, this is awesome.
> Some points though:
>
>    - not everybody uses IPython/Jupyter having the functionality for
>    conventional consols would also help. something like
>    Sypy's init_printing/init_session which smartly chooses the right
>    representation considering the terminal.
>    - I don't think putting everything in boxes is helping. it is
>    confusing. I would rather having horizontal and vertical square brackets
>    represent each nested array
>    - it would be awesome if in IPython/Jupyter hovering over an element a
>    popup would show the index
>    - one could read the width and height of the terminal and other
>    options I mentioned in reply Mark to show L R U P or combination of these
>    plus some numbers (similar to Pandas .head .tail) methods and then show the
>    rest by unicod 3dot
>
> P.S. I had no idea our university Microsoft services also offers Azure
> Notebooks awesome :P
>
> F.
>
> On Tue, Nov 6, 2018 at 9:45 AM Eric Wieser <wieser.eric+numpy at gmail.com>
> wrote:
>
>> Here's how that could look
>>
>>
>> https://numpyintegration-ericwieser.notebooks.azure.com/j/notebooks/pprint.ipynb
>>
>> Feel free to play around and see if you can produce something more useful
>>
>>
>>
>> On Mon, 5 Nov 2018 at 23:28 Foad Sojoodi Farimani <f.s.farimani at gmail.com>
>> wrote:
>>
>>> It is not highking if I asked for it :))
>>> for IPython/Jupyter using Markdown/LaTeX would be awesome
>>> or even better using HTML to add sliders just like Pandas...
>>>
>>> F.
>>>
>>> On Tue, Nov 6, 2018 at 6:51 AM Eric Wieser <wieser.eric+numpy at gmail.com>
>>> wrote:
>>>
>>>> Hijacking this thread while on the topic of pprint - we might want to
>>>> look into a table-based `_html_repr_` or `_latex_repr_` for use in ipython
>>>> - where we can print the full array and let scrollbars replace ellipses.
>>>>
>>>> Eric
>>>>
>>>> On Mon, 5 Nov 2018 at 21:11 Mark Harfouche <mark.harfouche at gmail.com>
>>>> wrote:
>>>>
>>>>> Foad,
>>>>>
>>>>> Visualizing data is definitely a complex field. I definitely feel your
>>>>> pain.
>>>>> Printing your data is but one way of visualizing it, and probably only
>>>>> useful for very small and constrained datasets.
>>>>> Have you looked into set_printoptions
>>>>> <https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.set_printoptions.html>
>>>>> to see how numpy’s existing capabilities might help you with your
>>>>> visualization?
>>>>>
>>>>> The code you showed seems quite good. I wouldn’t worry about
>>>>> performance when it comes to functions that will seldom be called in tight
>>>>> loops.
>>>>> As you’ll learn more about python and numpy, you’ll keep expanding it
>>>>> to include more use cases.
>>>>> For many of my projects, I create small submodules for visualization
>>>>> tailored to the specific needs of the particular project.
>>>>> I’ll try to incorporate your functions and see how I use them.
>>>>>
>>>>> Your original post seems to have some confusion about C Style vs F
>>>>> Style ordering. I hope that has been resolved.
>>>>> There is also a lot of good documentation
>>>>>
>>>>> https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html#numpy-for-matlab-users-notes
>>>>> about transitioning from matlab.
>>>>>
>>>>> Mark
>>>>>
>>>>> On Mon, Nov 5, 2018 at 4:46 PM Foad Sojoodi Farimani <
>>>>> f.s.farimani at gmail.com> wrote:
>>>>>
>>>>>> Hello everyone,
>>>>>>
>>>>>> Following this question
>>>>>> <https://stackoverflow.com/q/53126305/4999991>, I'm convinced that
>>>>>> numpy ndarrays are not MATLAB/mathematical multidimentional matrices and I
>>>>>> should stop expecting them to be. However I still think it would have a lot
>>>>>> of benefit to have a function like sympy's pprint to pretty print.
>>>>>> something like pandas .head and .tail method plus  .left .right .UpLeft
>>>>>> .UpRight .DownLeft .DownRight methods. when nothing mentioned it would show
>>>>>> 4 corners and put dots in the middle if the array is to big for the
>>>>>> terminal.
>>>>>>
>>>>>> Best,
>>>>>> Foad
>>>>>> _______________________________________________
>>>>>> NumPy-Discussion mailing list
>>>>>> NumPy-Discussion at python.org
>>>>>> https://mail.python.org/mailman/listinfo/numpy-discussion
>>>>>>
>>>>> _______________________________________________
>>>>> NumPy-Discussion mailing list
>>>>> NumPy-Discussion at python.org
>>>>> https://mail.python.org/mailman/listinfo/numpy-discussion
>>>>>
>>>> _______________________________________________
>>>> NumPy-Discussion mailing list
>>>> NumPy-Discussion at python.org
>>>> https://mail.python.org/mailman/listinfo/numpy-discussion
>>>>
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at python.org
>>> https://mail.python.org/mailman/listinfo/numpy-discussion
>>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at python.org
>> https://mail.python.org/mailman/listinfo/numpy-discussion
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181106/d4cf4dde/attachment-0001.html>


More information about the NumPy-Discussion mailing list