Scientific Programming with Python
Winter term 2019
Chair for Computational Social Science and Humanities
Florian Lemmerich and Sandipan Sikdar
Who is giving the course?
Florian Lemmerich Sandipan Sikdar
• Studied in Würzburg (Computer Science, Math, • PhD in Computer Science (Networks
History) and data mining) from Indian Institute
• PhD in Computer Science (Data Mining) in of Technology Kharagpur, India
Würzburg • PostDoc at CSSH in Aachen since
• Postdoc at “Gesis – Leibniz Institute for the Social March 2018
Sciences”
• “Akademischer Rat” since November 2017
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Programming Language
• Language of communication between human and computer
• A notation of describing computation to the computer
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Scientific Programming with Python
• Not about building a “system”
• Not about building a user interface
• Not always caring about all extreme cases
• Result oriented
• Using different libraries (“standing on the shoulders of giants”)
6 von 14 Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
…in Python
• Well-established and multi-purpose language
• Easy to read and learn
• Interpreted Language
• Strongly Typed
• Dynamically Typed
• Cross platform
• Slow (unless..)
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Python Usage
• NASA
• Youtube
• Reddit
• Quora
• Dropbox
• Pinterest
• Instagram
• ….
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Python Versions
• First appeared in 1991
• Created by Guido Van Rossum
• Current Python versions are 3.7.4 and 2.7.15
• Python 3
• First released in 2008
• Backward incompatible
• One should use Python 3
• Python 2 will retire in 2020
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Course goals
• Learn fundamentals of Python programming
• Brief overview of some of the libraries
• Enable you to use Python to solve your problem
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Course schedule
1 07.10.2018 Setup, variables, data types
2 14.10.2018 Data structures, Conditions, Loops
3 21.10.2018 Functions, Lambda expressions
4 28.10.2018 Advanced Data structures - Lists, Dictionaries, Tuples, Sets
5 04.11.2018 Modules, Packages, Errors, exception
6 11.11.2018 Input/Output, File handling
7 18.11.2018 Classes I
8 25.11.2018 Classes II
9 02.12.2018 Numpy and Misc topics [recursion, generator, decorator, iterator]
10 09.12.2018 Debugging and profiling
11 16.12.2018 Tour of Standard Libraries I (module, import)
12 06.01.2019 Tour of Standard Libraries II (formatting, templeting)
13 13.01.2019 Pandas (numpy)
14 20.01.2019 Data analysis with Python (teaser for the next semester)
15 27.01.2019 Summary & Outlook
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
So after this course, you should be able
• Write basic Python programs
• Write your own packages
• Use basic Data analysis tools
• Learn and use new Python libraries
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Exercises
• We will have notebooks with exercises each week
• Work through the tasks during exercise sessions
• Complete the remaining tasks at home (at your own responsibility)
• Solutions will be uploaded next week
• 2-3 graded assignments
• Will make 10% of the course grade
• 2-3 weeks time to complete the assignments
• NO PLAGIARISM
• Cite all your resources
• Don’t share your code (at all)
• Plagiarized submission -> we exclude both parties from the exam
• No warnings
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Course Grading
• Final exam
• Written exam/pen & paper
• Tentative date: February 3, 2020
• Precondition for participation
• Need to score at least 50% on the home assignments
• Grading
• Additional bonus points if you score more in the home assignments
• Max bonus is 10% of the points in exam
• 50% is sufficient to pass the exam
• Bonus points will only be added if you score at least 50% in the final exam
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Setup
• Recommended for the course - Anaconda
• Open source
• Includes -
• Python
• Conda package manager
• Many Python packages
• Ipython/Jupyter
Download: https://www.anaconda.com/download/
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften
Running Python code
• Python interpreter
• IPython interpreter
• Python script
• Jupyter notebook (we will be using this)
Prof. Dr. Markus Strohmaier
Lehrstuhl für Methodik und Theorie computer-basierter Geistes- und
Sozialwissenschaften