/intro_to_python

Files for the Intro to Python workshops

Primary LanguageJupyter Notebook

UCSD IDEA: Intro to Python

Files for the Intro to Python workshops, presented by the IDEA Student Center of UC San Diego.

Requirements

  • python 2.x or 3.x
  • jupyter notebook (formerly known as ipython-notebook)
  • numpy
  • matplotlib

Installation

We highly recommend installing Python and related scientific packages using Anaconda, a free Python distribution available for with Windows, macOS and Linux. To install:

  1. go to the Anaconda download page: https://www.anaconda.com/download/
  2. download the Python 3.x installer for your OS
  3. run the installer

NOTE: The installer is large (approx. 600 MB), and can take a while to download and run. Which is why we ask workshop participants to perform the installation before arriving to the workshop.

Starting Jupyter Notebook

The Python code in this repository uses Jupyter Notebook, a popular graphical interface for writing and running Python code which uses your web browser. To start Jupyter Notebook, you can either:

  • a) use the Anaconda Navigator app: open the app and click "Launch Jupyter Notebook"
  • b) open a terminal (Windows: Anaconda Prompt, macOS: Terminal.app), type "jupyter notebook" (without quotes) and hit enter to execute the command

For either option, you should see a terminal window open briefly and then your default web browser should open, with the URL set as localhost:8888.

Trying the code out (online)

If you're having trouble installing or running Python locally, you can try using the Binder online service to run the Python code: Binder

NOTE The Binder service is free, but it is a temporary fix.

Further resources

If you're switching to Python from Matlab, this guide covers most of the common code equivalents: https://docs.scipy.org/doc/numpy-dev/user/numpy-for-matlab-users.html

Examples of plotting with Matplotlib: http://matplotlib.org/gallery.html

Notes from a talk about writing beautiful Python code: https://gist.github.com/JeffPaine/6213790