Skip to content

The Python crash course of the Summer Institute in Computational Social Science 2022!

Notifications You must be signed in to change notification settings

rlcmtzc/SICSS-Python-Crash-Course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SICSS Aachen-Graz - Python Crash Course

Welcome to the Python crash course of the Summer Institute in Computational Social Science!

In the first week, you will learn the basics of programming in Python: data types, data structures, branching, loops, and functions. In ./tutorials, you'll find interactive notebooks explaining these concepts (for each day there is one notebook). They include links to video tutorials for those of you who prefer spoken explanations over reading. To practice the newly learned skills, check out the examples in ./exercises! (Again one notebook for each day).
The table bellow gives you an overview of the weeks content and the links to the tutorials and exercises:

Day Tutorial Exercise
1 Print, Comments, Strings and Numbers Exercise 1
2 Datastructures and Loops Part 1 Exercise 2
3 Booleans, Conditions and Loops Part 2 Exercise 3
4 Functions Exercise 4
5 File I/O Exercise 5_1 and Exercise 5_2

The second week covers working with tabular data, plotting, basic statistics, and networks. For those topics, we'll skip the explanatory notebooks and go straight for practical tasks (again found in ./exercises). But don't worry, the task descriptions contain links to helpful videos and documentation pages :)
The table bellow gives you an overview of the weeks content and the links to the exercises:

Day Tutorial Exercise
1 pandas Part 1 Exercise 6
2 pandas Part 2 Exercise 7
3 Plotting with matplotlib Exercise 8
4 Basic Statistics with scipy and statsmodels Exercise 9
5 Networks with networkx Exercise 10

Setup

There are many different environments in which you can work with Python. To simplify the setup, we encourage you to use Google Colab: https://colab.research.google.com/. It provides a notebook environment with all the required packages already installed. To get the content of this repository into Colab, download it (click the green "Code" button at the top right and select "Download ZIP"), extract the content, and upload it to your Google Drive. You should then be able to open the notebook files in Colab.

Alternatively, you can follow the steps to set up a local Python environment:

Install Python locally

Do this only if you're not using Goole Colab!!

  • Download the latest installer for your operating system here: https://www.python.org/downloads/
    If you use Linux, execute the following commands instead (and skip the steps below)
    sudo apt-get update
    sudo apt-get install python3.10
    
    • Open the downloaded Python installer. Make sure to check the "Add Python 3.10 to PATH" mark!
    • Click "Install Now". This may take a while.
    • To finish the installation click "Close".
  • To check if you successfully installed Python open up a terminal window:
    • Windows: press the Windows key , enter cmd, and hit enter.
    • MacOSX: press and enter Terminal
    • Linux: press the "Super key" and enter Terminal
  • Type python --version and hit enter. You should see something like Python 3.10.4.

Install a notebook environment

There are multiple notebook environments available. Below are two of the most commonly used:

VS Code

Visual Studio Code is a general-purpose text editor. It Python extension provides in-depth support for developing Python programs, including a notebook environment. For that to work, a kernel is required. To install, open a terminal and execute

python -m pip install ipykernel

Click here for detailed instructions on working with notebooks in VS Code.

JupyterLab

JupyterLab is an interactive notebook environment. You can open the .ipynb files provided for tutorials and exercises as well as other text-based files. To install, enter

python -m pip install jupyterlab

in the terminal. To run JupyterLab, execute

python -m jupyter lab.

A browser window should pop up with JupyterLab loading. Don't close your Command Prompt while working in jupyter lab. Click here for a documentation of the JupyterLab Interface and how to use it

Which one should i choose?

JupyterLab is the more simple and lightweight option. VS Code provides much better autocompletion and helps finding mistakes early - it might feel overwhelming at first, but if you plan on programming more, it'll be worth your effort!

About

The Python crash course of the Summer Institute in Computational Social Science 2022!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published