In this session, we will learn some fundamentals in working with Python. So make sure you have a working copy of Python running on your machine.
In this session, we will concentrate on very basic functionality in using Python as to allow you to read and modify some of the example scripts provided the Python tutorial underlying the course. We will have a look at some basic commands in Python, how to write and open Python scripts from the command line, flow control in scripts, and the definition and loading of functions.
The examples given in the session will largely follow those given in two excellent introductory tutorials.
- Swaroop Chitlur: A Byte of Python.
- Al Sweigart (2015): Automate the Boring Stuff with Python: Practical Programming for Total Beginners. No Starch Press.
For a more comprehensive introduction, make sure to check out The Quick Python Book by Naomi Ceder:
- Naomi Ceder (2018) The Quick Python Book. 3rd ed. Manning Publications.
We will have only time to discuss a small selection of content covered in these tutorials but make sure to spend some time after the course working through these tutorials. This will help you massively in becoming more self-proficient in the use of Python and ultimately allow you much more flexibility in collecting and analyzing digital trace data.
Another option for teaching yourself the basics of Python is a free interactive introductory course to Python offered by codecademy.
For a guide to further readings in working with Python from a social scientist’s perspective make sure to check out Nick Eubank‘s Data Analysis in Python.
As you have probably gathered by now, this session will only offer you the most preliminary of introductions to the use of Python. But do not worry. If you caught the bug, there are excellent guides available to you taking you further down the rabbit hole.
For a broader view of collecting digital trace data beyond Twitter see:
- Matthew A. Russell. Mining the Social Web. 2nd ed. Sebastopol, CA: O’Reilly Media, 2014.
For a very helpful introduction to data analysis with Python see:
- Wes McKinney (2017) Python for Data Analysis 2nd ed. O’Reilly Media, Inc.
For a handy introduction to machine learning with Python see:
- Sebastian Raschka. Python Machine Learning. 2015. PACKT Publishing.
Remember, you might have online access to O’Reilly and PACKT books through your university’s library.