Digital Humanities Research Institute: Binghamton 2019

Intro to Python


Lesson Overview

Python is a general-purpose programming language that is suitable for a wide variety of core tasks in the digital humanities. Learning the fundamentals of Python is a gateway to analyzing data, creating visualizations, composing interactive websites, scraping the internet, and engaging in distant reading of texts. This session will introduce participants to writing code in Python using Jupyter Notebooks, an open source web application used to create and share documents that contain live code, equations, visualizations, and text. We will begin with a basic overview of programming languages in general, talk about Python and its use in digital humanities, and look at the following two examples of humanities projects using Python: Ritvik Kharkar's "Making 3 Easy Maps with Python" and Nick Monfort's "Taroko Gorge" poem.
*NOTE: Also view Ritvik Kharkar's "Quick and Dirty Data Gathering with Python" to learn more about Kharkar's data gathering technique for the above three maps.

We will then get into an overview of Anaconda Navigator and Jupyter Notebooks, followed by hands-on exercises of coding in Python. The goal for this intro session is to learn the basic Python commands that could then be used and applied to participants' own future research and projects.

By the end of this session, participants will know fundamental Python commands and have an understanding of how Python can be used in digital humanities research.

Download Requirement

Anaconda Distribution 3.7: https://www.anaconda.com/distribution/ (make sure to install the proper version for your operating system, i.e. Windows or MacOS)

Resources for Keywords, Functions, Types, and Statements in Python

"List of Keywords in Python"
W3schools.com "Python Keywords"
W3schools.com "Python Built-in Functions"
W3schools.com "Python Dictionaries"

Further Readings and Tutorials

"Pyslackers"
"CheckiO" Tutorials
"Learn Python" Tutorials
"Python Beginner's Guide for Non-Programmers"
Dan Bader (2018) "Real Python" Video Tutorials
Sagar Bhatia (March 2019) "Top Programming Terms and Definitions for Beginners"
Scott B. Weingart (February 2017) "Teaching Yourself to Code in DH"
Shelly Tan (June 2014) "Five mini programming projects for the Python beginner"
Folgert Karsdorp "Python Programming for the Humanities"
Benjamin Pryke (May 2018) "Jupyter Notebook for Beginners: A Tutorial
Mike Driscoll (January 2019) "Jupyter Notebook: An Introduction"
Mihail Yanchev (July 2018) "The most (time) efficient ways to import CSV data in Python"
Albert (January 2019) "Introductory Notes to Python"
Bryn Mawr College (April 2017) "What are Jupyter Notebooks? Why would I want to use them?
 

This page references: