Summary and Schedule
This lesson introduces Python fundamentals with examples from libraries, scholarly publishing and research data management: article processing charges from OpenAPC and publication metadata from the DataCite API. It does not cover other library data formats such as XML or MARC.
This lesson is an introduction to programming in Python for people working in libraries and research data management with little or no previous programming experience (see the Learner Profiles for examples of the kinds of people who might benefit from this lesson). It covers the basics of the Python language, the analysis of tabular data with the pandas library, and retrieving metadata from a web API. The lesson uses the JupyterLab computing environment and Python 3.
This edition is maintained by ZB MED – Information Centre for Life Sciences and is based on teaching material developed at ZB MED and on the Library Carpentry lesson Python Intro for Libraries.
Prerequisites
Learners need to understand what files and directories are and what a working directory is.
Learners must install Python and JupyterLab before the workshop begins. Please see the setup instructions for details.
Learners need an internet connection during the lesson, as the data is downloaded directly from the web.
Learning Objectives
After attending this training, participants will be able to:
- Use core Python syntax, variables, data types, functions and methods in the JupyterLab interface.
- Store data in lists and dictionaries, and control program execution with loops and conditional logic.
- Load, inspect, filter and plot tabular data with the pandas library.
- Retrieve publication metadata for DOIs from the DataCite API and work with JSON data.
| Setup Instructions | Download files required for the lesson | |
| Duration: 00h 00m | 1. Getting Started |
How can I identify and use key features of JupyterLab to create and
manage a Python notebook? How do I run Python code in JupyterLab, and how can I see and interpret the results? |
| Duration: 00h 20m | 2. Variables and Data Types |
How do I run my first Python command? How can I store values in Python? What kinds of data can Python work with? |
| Duration: 00h 40m | 3. Operators, Functions and Methods |
What can I do with values of different types? What happens when I combine values of different types? What are functions and methods? |
| Duration: 01h 05m | 4. Lists and Dictionaries |
How can I store many values together? How can I store and retrieve values by name? |
| Duration: 01h 30m | 5. Loops and Conditionals |
How can I do the same thing for many values? How can my program make decisions? |
| Duration: 01h 55m | 6. Introduction to pandas |
How can I work with tabular data in Python? How much did a university pay on average for article processing charges? |
| Duration: 02h 30m | 7. Retrieving Metadata from an API |
How can I get metadata for a DOI automatically? How do I work with JSON data in Python? |
| Duration: 03h 00m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Installing Python Using Miniforge
Python is a popular language for scientific computing, and great for general-purpose programming as well. For this workshop we use Python version 3.10 or newer. Installing all of its scientific packages individually can be a bit difficult, so we use the Miniforge distribution of Python, which helps you take care of them all together.
Please refer to the Python section of the workshop website for installation instructions.
The lesson uses the following packages:
- pandas (version 2.1 or newer)
- matplotlib (version 3.8 or newer)
JupyterLab
We will teach Python using JupyterLab, a part of a family of Jupyter tools that includes Jupyter Notebook and JupyterLab, both of which provide interactive web environments where you can write and run Python code. If you followed the instructions linked above, JupyterLab is installed on your system. Alternatively, you can install JupyterLab on its own using conda, pip, or other popular package managers.
Create a folder for the workshop
Create a new folder on your Desktop called lc-python. We
will save our notebooks and downloaded data in this folder.
Data
You do not need to download any data in advance. During the lesson we download:
- data on article processing charges (APCs) paid by FU Berlin in 2015 from the OpenAPC project, licensed under the Open Database License, and
- publication metadata from the DataCite REST API.
Please make sure you have a working internet connection during the workshop.