I have a .ipynb file that uses numpy arrays. How do I view the numpy array?

已回答

I have a `.ipynb` file that uses numpy arrays. How do I view the numpy array?
Right now I can only view my data using a print() call. I cannot put a breakpoint in it because it is an `.ipynb` file and the print call does not show all the data. e.g. `[0.62632252 1.2015177  1.07629022 ... 1.06810746 1.12036821 1.01505016]` this is a really long array on I only see the first and last three data points. 

0

Hello, Tbradford8!

There is a function in numpy that controls print options:

import numpy as np
np.set_printoptions(threshold=np.inf)

This code calls the set_printoptions function and passes the threshold argument with the infinity value np.inf. This should work for you.

Also, this question was already answered here at Stackoverflow, so it's better to search for your questions about numpy there.

0

Dvamuch The IDE will not display the print lines when I do that. It will hang for a while then quit. The numpy arrays I would like to inspect are only a few thousand array positions long. It should be able to show that. In the past when using Pycharm scientific mode it could easily handle viewing arrays while debugging. For some reason, I can't debug using Pycharm while using ipynb files either. 

0

Hi Tbradford8

Sorry for not getting back to you sooner. Please refer to this article to get more information on how you can view variables in Jupyter Notebooks https://www.jetbrains.com/help/dataspell/running-jupyter-notebook-cells.html#view-variables.

0

请先登录再写评论。