Data Wrangling Course

James Howison's Data Wrangling course from the Information School at the University of Texas at Austin.

Hello World in Python

In this class we test our setup by getting a very simple Python script up and working. “Hello World” has a venerable history in programming and XKCD has a comic specifically about Hello World in Python.

We will be using the Docker installs that we have in place on our laptops. Details of the setup are on the Tech Setup page (which we did earlier in the semester, so ideally nothing should need to be installed). DataCamp also uses embedded Jupyter Notebooks (and they are standard for Data Science work).

You will be working in the Jupyter Notebook. When you have run docker-compose up you will be able to access that from the Application Links.

“The Programming Historian” has a useful introduction to the Jupyter Notebook interface. Read down from that link to the first paragraph of “Working in Jupyter notebooks”.

Creating a new Jupyter Notebook file

Navigate to your Docker jupyter notebook. Log in with the password data. You will see the Jupyter file browser interface. The embedded video below shows creating a new Python 3 notebook (click to play/pause/restart).

You can then name the file, by clicking on the name at the top, which is “Untitled” by default.

You can then copy the code from the code sections on these pages into cells in Jupyter. You execute the code by hitting shift-enter (or clicking the “Run” button). You see relevant output immediately below that cell.

In addition to our recorded Tuesday class, I have available a screencast from a previous year. This doesn’t use Notebooks but the code is identical Hello World in Python. s You can copy this code into a cell in Jupyter, after creating a new Notebook.

print("Hello World!")

On to [Variables](