Jupyter
9 flashcards · Computer Science · by lakesare
What is a notebook document (.ipynb)?
Notebook files can serve as a complete computational record of a session, interleaving executable code with explanatory text, mathematics, and rich representations of resulting objects. Notebook documents are both human-readable documents containing the analysis description and the results (figures, tables, etc..) as well as executable documents which can be run to perform data analysis. These documents are internally JSON files and are saved with the .ipynb extension. Since JSON is a plain tex…
What kernels are there?
There are kernels for different versions of Python, and also for over 100 languages. A Jupyter kernel is a program responsible for handling various types of requests (code execution, code completions, inspection) You may have noticed that Jupyter gives you the option to change kernel, and in fact there are many different options to choose from. Back when you created a new notebook from the dashboard by selecting a Python version, you were actually choosing which kernel to use.There are kernels…
What's this?
Line magic %matplotlib inline - a line magic to instruct Jupyter to capture Matplotlib plots and render them in the cell output.
Name 3 ways to share your Jupyter.
Export it as an .html or .pdf file Github has direct support for .ipynb files GitHub has integrated support for rendering .ipynb files directly both in repositories and gists on its website.nbviewer Initially developed before GitHub’s Jupyter Notebook integration, NBViewer allows anyone to enter a URL, Gist ID, or GitHub username/repo/file and it will render the notebook as a webpage.
Name 2 interesting Jupyter magics.
%run - run the file as a part of a cell being executed %timeit - time how long code cell takes to execute
Jupyter VS Jupiter?
Jupyter - Julia, Python, R Jupyter's name is a reference to the three core programming languages supported by Jupyter, which are Julia, Python and R, and also a homage to Galileo's notebooks recording the discovery of the moons of Jupiter.Jupiter - a planet Galileo Galilei's manuscript from 1610 with observations of Jupiter (⊛) and four of its moons (✱), whose depiction helped inspire the Jupyter logo.
How to execute a shell command VS a magic?
shell command - !echo Hello World!! magic - %timeit Note that the shell in which ! commands are executed is discarded after execution completes, so commands like cd will have no effect. However, IPython magics offer a solution. Magics are handy commands built into the IPython kernel that make it easier to perform particular tasks. Although they often resemble unix commands, under the hood they are all implemented in Python.
How to debug Python jupyters?
%pdb line magic will toggle on/off the automatic triggering of pdb on error across all cells in your notebook. Another handy debugging magic is %debug, which you can execute after an exception has been raised to delve back into the call stack at the time of failure.
What does %load VS %run do?
%load hi.py - will replace the cell contents with the loaded file. %run hi.py - will additionally run the lines