Introduction to Programming using Python
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets try margin right May 3, 2018
class0 add Apr 10, 2018
class1 typo Apr 12, 2018
class2 update Apr 19, 2018
class3 small clean up May 3, 2018
class4 update Apr 24, 2018
class5 add slides May 1, 2018
class6 add slides May 1, 2018
old add Apr 1, 2018
.gitignore started class 3 Apr 18, 2018 Merge branch 'master' of May 3, 2018
README.pdf updated readme Jan 28, 2018 add Apr 10, 2018

Introduction to Programming using Python

This is meant to be a short course that helps you to start programming in Python, especially if you have little to no background in programming. There is no need for yet another course on how to learn Python, instead I will select a subset of topics that are likely to be interesting for researchers, give a short introduction and point towards resources where you can learn more. First we will cover the basics of how to program in Python and get everyone up and running. After having mastered the very basics, each student will design a small programming project, e.g. downloading data from the internet, reorganizing a dataset, statistical analysis of some data... In general many repetitive tasks can be automated in a python script and we'll learn how to do that in the next few weeks. Over time you will appreciate the versatility and simplicity of Python!

Some Links:

Class 0 - Git and installing python

Slides - Class 0

  1. Before we start with Python, you should make yourself familiar with Git and Github. Git is a distributed version control system, mainly used for code. To get familiar with git follow this tutorial

  2. Install Python. I suggest the Anaconda Distribution. It comes with many packages preinstalled and an IDE similar to RStudio. Please install python 3.*

How to Install Packages with conda

  1. check for the right link by searching for it: e.g. search for conda install unidecode
  2. you will find this
  3. using conda you run: conda install -c anaconda unidecode (This is NOT a python command!)
  • open the "Anaconda prompt" on Windows, or the "terminal" on Mac/Linux
  • type conda install -c anaconda unidecode and press enter, say yes if conda asks you to install packages

Excercises Class 0

0.1. Make a repository on github put some file in it and push it to the server 0.2. Open Spyder and run the "Hello World!" program.

Class 1 - First Introduction to Python

Slides - Class 1

  • Basic introduction: Define variables, lists and dictionaries
  • Operators on numbers/strings
  • Data types
  • Booleans
  • if-else, for-, while-loops

Class 2 - Programming Essentials

Slides - Class 2

After this class you know the most important programming concepts, based on which you can write almost any program.

  • Revisit basics
  • Functions
  • import a package
  • numpy/scipy/pandas

Class 3 - Interacting with the web, File IO

Slides - Class 3

  • urllib
  • File IO using pandas and open/csv
  • Beautiful Soup
  • Selenium, for dynamic interaction with websites.

Class 4 - Student Projects

Slides - Class 4

From now on, classes will be more like a QA session. You can only learn programming by doing, therefore it's important to get started on your projects and along the way I can help with issues that come up.

  • Plan your own project using python, what concepts do you need to learn? What packages do you need?

Don't know where to start/what to do? Checkout these links:

  1. edX Course on Python for Research
  2. Andy Halterman for stuff on creating/analyzing event data: or his Github page
  3. Natural Language Processing: e.g. Spacy
  4. Face Recognition (as a service) by Face++
  5. Extract text from PDFs: pdfminer

For some tips on best practices for your own code see the top answer here.

Class 5 - Web APIs

Slides - Class 5

  1. How to use a Web API (Follow the Money example)
  2. Projects?

Class 6: Support and Presentation of projects

Slides - Class 6

  • Work on personal project
  • Help with issues and setup of project.
  • students should present their use case