ipython

IPython, "name 'plt' not defined"

IPython, "name 'plt' not defined" Question: I recently installed Atom as an IDE on my laptop, for university. I installed Hydrogen as a convenient solution to show some plots on the go. But whenever I run Hydrogen, I get this error: NameError Traceback (most recent call last) < ipython-input-1-1eb00ff78cf2> in <module> —-> 1 plt.show() NameError: …

Total answers: 2

what is the relation and difference between ipython and jupyter console

what is the relation and difference between ipython and jupyter console Question: After the ipython notebook project renamed to jupyter, I always think that ipython notebook is the same as jupyter notebook and ipython shell is just an alias of jupyter console. Today I realize that ipython does not have connect_info magic defined and therefore …

Total answers: 1

How do I embed a gif in Jupyter notebook?

How do I embed a gif in Jupyter notebook? Question: I’ve been trying to display a gif in Jupyter notebook and have had some trouble. I keep getting a blank image file. I’ve tried using html from this GitHub repository. ![wignerfunction][1](../gifs/wigner_rotation_animate.gif “wigner”) And from IPython.display import Image Image(url=’example.gif’) None of the above have worked so …

Total answers: 6

Cannot turn numpy array into a graph in SageMath

Cannot turn numpy array into a graph in SageMath Question: After downloading testnb.sws following the instructions on the website https://sourceforge.net/p/networksym/code/ci/master/tree/ I tried to run it in the legacy “Sage Notebook” (not the Jupyter notebook), as follows: open the Sage Notebook click “Upload” click “Browse” select testnb.sws click “Upload worksheet” click “Evaluate” Evaluating the code cell …

Total answers: 1

How do I make 2 images appear side by side in Jupyter notebook (iPython)?

How do I make 2 images appear side by side in Jupyter notebook (iPython)? Question: I want to display 2 PNG images in iPython side by side. My code to do this is: from IPython.display import Image, HTML, display img_A = ‘pathtoimg_A.png’ img_B = ‘pathtoimg_B.png’ display(HTML(“<table><tr><td><img src=img_A></td><td><img src=img_B></td></tr></table>”)) But it doesn’t output the images, and …

Total answers: 6

IPython magic print variables on assignment

IPython magic print variables on assignment Question: Is there a parameter in IPython to print the variables each time I assign them? Currently: In [1]: a = 5 In [2]: a Out[2]: 5 In [3]: b = a + 1 In [4]: b Out[4]: 6 In MATLAB, the variable is printed unless one writes a …

Total answers: 2

How to get ipywidgets working in Jupyter Lab?

How to get ipywidgets working in Jupyter Lab? Question: In Jupyter Notebook, ipywidgets work fine, however they seem to not work in Jupyter Lab (which is supposedly better than Notebook). I followed these directions. Step 1: Installed Node.js (https://nodejs.org/en/) Step 2: Installed requirements on Python 3 with conda: conda install -c conda-forge ipywidgets jupyter labextension …

Total answers: 11

How to show line numbers in Google Colaboratory?

How to show line numbers in Google Colaboratory? Question: Normally it is possible in jupyter or iPython notebooks to show lines number for a cell, however I don’t see where in Google Colaboratory (Colab). Asked By: Guillaume Chevalier || Source Answers: Holding Ctrl and pressing ML (one by one) switches on/off line numbers in the …

Total answers: 3

`del` on a package has some kind of memory

`del` on a package has some kind of memory Question: del seems to have some memory which puzzles me. See the following: In [1]: import math In [2]: math.cos(0) Out[2]: 1.0 In [3]: del math.cos In [4]: math.cos(0) ————————————————————————— AttributeError Traceback (most recent call last) <ipython-input-4-9cdcc157d079> in <module>() —-> 1 math.cos(0) AttributeError: module ‘math’ has …

Total answers: 3

Is it possible to show `print` output as LaTeX in jupyter notebook?

Is it possible to show `print` output as LaTeX in jupyter notebook? Question: I was writing a very simple script to count ellipsoid area and volume and some other things. I was presenting my output printing it out like this: print(‘Dims: {}x{}mnArea: {}m^2nVolume: {}m^3’.format(a, round(b,2), P, V)) What, of course, gave this output (with sample …

Total answers: 3