From Rasmapedia
Jump to navigation Jump to search
  • Dataquest.io has a very good tutorial on how to use Jupyter, the other interface besides Spyder for running Python code.
  • It looks like the main use of Jupyter is to save Python input and output in a convenient way. A *.py file just has the input. A Jupyter file runs in a browser window, but that doesn't seem to be important. Jupyter also divides the programs into cells, sections, so you can in Cells select "Run Cells and selection below" to run the current cell and move down to the next cell.
  • When I use Jupyter, search for Jupyter on my computer, launch it, and then do not shut off the black box that will appear along with the app itself (or it will stop working right).
  • To put something into Markdown comment language instead of Python, switch the box at the top of the editor from Code to Markdown.
  • Jupyter can be configured in Python to have a non-default home directory. Or, these Python commands are convenient:

import os; os.chdir('c:\\Users\\erasmuse\\Dropbox\\python\\') %pwd is a Jupyter "magic" command that says the present working directory. %matplotlib inline is one example, which says notebook plots will be dislpayed. %timeit range(40) all on one line is another.

  • You don't have to use the print command to get the value of a new variable; you can just type its name. This is like interactive, a shell not batch. Sort of. Except you do have to keep Running cells.