Geo-Python Logo
2019

Course information

  • General info
    • Course meetings in Period I
    • Instructors
      • Lecturers
      • Course assistants
    • Course websites
  • Learning goals
  • Grading
    • General grading breakdown
  • Installing Python
    • Install Python on Windows
    • Install Python on macOS
    • Install Python on Linux
    • Installing packages using Conda
      • The easiest way
      • Installing Jupyter Lab using conda
      • Alternative way to install packages if typical doesn’t work
  • Vocabulary - Basic terms
    • Python vocabulary
    • Basic vocabulary of Version Control
  • Resources
    • Books
    • Python tutorials
    • Git + Github tutorials
  • License and terms of usage
    • Instructional materials
      • you are free to
      • Under the following terms
      • Notices
    • Code snippets / software

Lesson 1

  • Motivation for the course
    • Effective data visualization
  • Lesson overview
    • Learning goals
    • Lecture video
    • Lecture slides
  • Course environment
    • JupyterLab
    • Cloud computing environments
      • Binder
      • CSC Notebooks
    • Using your own computer
    • Git and GitHub
    • Slack
    • Voting and polling
    • Page summary
  • Communicating with Slack
    • Accessing the workspace in Slack
    • Overview of Slack
    • Basic usage of Slack
      • Notifying a user
      • Using threads
    • General guidelines for communication
  • A taste of Python
    • General information
      • Sources
      • About this document
      • Getting started
    • Variables, math and functions
      • Simple Python math
      • Functions
      • Math operations
        • Check your understanding
      • Combining functions
      • Variables
        • Check your understanding
      • Updating variables
      • Variable values
      • Data types
        • Check your understanding
      • Character input
  • Good coding practices - Selecting “good” variable names
    • Some “not-so-good” variable names
    • Selecting “good” variable names
    • Formatting “good” variable names
  • Exercise 1
    • Part 1 - Creating a GitHub.com account and using Slack
    • Part 2 - Cooking up some Python
    • Summary (what to submit)

Lesson 2

  • Lesson overview
    • Learning goals
    • Lecture video
  • Basic elements of Python
    • Sources
    • Data types revisited
      • Let’s start with some data
      • Reminder: Data types and their compatibility
      • Converting data from one type to another
      • Combining text and numbers
    • Lists and indices
      • Creating a list
      • Index values
      • A useful analog - Bill the vending machine
      • Number of items in a list
      • Index value tips
      • Modifying list values
      • Data types in lists
      • Adding and removing values from lists
      • Appending to an integer? Not so fast…
      • Some other useful list methods
      • Reversing a list
      • Sorting a list
  • Good coding practices - Describing your code
    • Do I need to describe my code?
    • But seriously, the Internet says I shouldn’t comment my code
    • Code comments
      • Line comments
      • Block comments
    • Markdown text
      • Data source
  • Introduction to Version Control
    • Familiar?
    • What is version control?
    • What is Git?
    • What is GitHub?
      • Relies on Git
      • Social (collaborative) network
      • Open source / science
      • Documentation
      • Online tools
      • Issue tracking
    • Basic vocabulary
    • Resources
  • Meet Git
    • Overview and preparations
    • Key concepts and tools
    • Using Git from the command line
      • Configuration
      • Clone a repository from GitHub
      • Add changes to the staging area
      • Commit changes
      • Publish your local commits to GitHub
    • Using the JupyterLab Git plugin
      • Preparations in the Terminal
      • Stage changes in the plugin
      • Commit changes in the plugin
      • Pull and push using the plugin
    • If everything else fails…
  • Using Classroom for Github
    • Classroom for GitHub
  • Exercise 2
    • Cloud computing environments
    • Exercise 2 hints
      • Git
      • List methods
      • Indentation woes

Lesson 3

  • Lesson overview
    • Learning goals
    • Lecture
  • for loops
    • Sources
    • Basics of for loops
      • A (bad) example
      • Introducing the for loop
      • for loop format
        • Your daily for loop
      • for loop variables
      • for loops and the range() function
        • Poll question pause
      • Looping over the length of lists using index values
      • Why bother looping over a list by the index value?
        • Poll question pause
  • Conditional statements
    • Sources
    • Basics of conditional statements
      • A simple conditional statement
      • Comparison operators and boolean values
      • if, elif and else
      • Combining conditions
    • Combining for-loops and conditional statements
  • Good coding practices - writing readable code
    • Working code vs readable code
    • PEP 8 Style Guide
      • Maximum line length
      • Indentation
      • Whitespace and binary operators
      • Avoid extraneous whitespace
      • Write one statement per line
  • Exercise 3
    • Cloud computing environments
    • Exercise 3 hints
      • General tips
      • Tests
      • Combining strings
      • Nested if statements

Lesson 4

  • Lesson overview
    • Learning goals
    • Lecture
    • Lecture
  • Functions
    • Sources
    • What is a function?
    • Anatomy of a function
      • Our first function (aww…)
    • Calling functions
      • Using our new function
      • Let’s make another function
      • Using our second function
        • Check your understanding
      • Functions within a function (Yo dawg…)
      • Using our combined functions
    • An introduction to script files
      • The general concept of a .py script file
      • Getting started
      • Saving a text file as a Python file
    • Saving and loading functions
      • Saving functions in a script file
    • Calling functions from a script file
      • Making sure we’re in the right working directory
        • Binder users
        • CSC notebooks users
      • Changing the working directory
        • Binder users
        • CSC notebooks users
      • Importing our script functions
      • Using our script functions
        • Importing multiple functions
      • Importing all functions from a script
    • Temperature calculator (optional, advanced topic)
      • Defining the function
      • Adding some conditional statements
      • Returning the result
      • Adding a docstring
      • Testing the new function
      • Using the tempCalculator
  • Loading and using modules
    • Modules, packages and libraries?
    • Loading modules
      • Renaming imported modules
      • Importing a single function
      • Importing a submodule
    • Using module functions
    • What should I not do?
      • from X import *
      • Poor names when renaming on import
    • Extra: installing packages
  • Good coding practices - Writing our scripts the “right” way
    • Inline comments
    • Use line breaks wisely
    • Use a docstring
    • Advanced topics
      • Adding a license
      • Starting with a shebang
    • Page summary
  • Exercise 4
    • Cloud computing environments
    • Exercise 4 hints
      • Importing variables from a script
      • Counting values from a list

Lesson 5

  • Lesson overview
    • Learning goals
    • Lecture videos
  • What is Pandas?
    • Easy-to-use data structures
    • Combines functionalities from many Python modules
    • Supports data read/write from multiple formats
  • Exploring data using Pandas
    • Input data: weather statistics
    • Reading a data file with Pandas
    • DataFrame properties
    • Selecting columns
    • Descriptive statistics
    • Extra: Very basic plots
    • Extra: From lists to pandas objects
  • Processing data with Pandas
    • Basic calculations
    • Selecting rows and columns
    • Filtering and updating data
    • Dealing with missing data
    • Data type conversions
    • Unique values
    • Sorting data
    • Writing data to a file
  • Exercise 5
    • Exercise 5 hints for Pandas

Lesson 6

  • Lesson overview
    • Learning goals
    • Lesson videos
  • Data processing with Pandas, part 2
    • Motivation
    • Input data
    • Downloading the data
      • CSC Notebooks users
      • Users with Jupyter on their personal computers
      • Binder users
    • About the data
    • Reading the data
    • Renaming columns
    • Check dataframe properties
    • Using your own functions in pandas
      • Iterating over rows
      • Applying a function
    • Parsing dates
      • String slicing
      • datetime
    • Aggregating data in Pandas by grouping
    • Detecting warm months
    • Repeating the data analysis with larger dataset
  • Dealing with errors
    • Interpreting error messages
      • Reading error messages
      • Common errors and exceptions
        • IndexErrors
        • NameErrors
        • IndentationErrors
        • TypeErrors
        • Other kinds of errors
      • More information
  • Good coding practices - Using assertions
    • Assertions
      • Multiple assertions
        • A bad example
        • A better example
      • More information
  • Debugging your Python code
    • Source
    • Test your code with known outputs
      • Testing with a simplified data file
    • Make your code crash quickly and regularly
    • Make small changes and track them
  • Exercise 6
    • Cloud computing environments
    • Exercise 6 hints
      • Data format for problems 1-3
      • Reading in fixed-width text files
      • Skipping the second row of a file
      • Joining data from one DataFrame to another

Lesson 7

  • Lesson overview
    • Learning goals
    • Lesson videos
  • Plotting in Python
  • Anatomy of a plot
    • Common terms when doing plotting
  • Plotting with Pandas (…and Matplotlib…and Bokeh)
    • Input data
    • Downloading the data
      • Binder users
    • About the data
    • Getting started
    • Basic x-y plot
      • Selecting our plotted data
    • Basic plot formatting
      • Embiggening* the plot
      • Other common plot formatting operations
        • Adding text to the plot
        • Changing the axis ranges
        • Dealing with datetime axes
    • Bar plots in Pandas
    • Saving your plots as image files
    • Interactive plotting with Pandas-Bokeh
  • More advanced plotting with Pandas/Matplotlib
    • The data
    • Getting started
      • Loading the data
    • Preparing the data
      • Converting temperatures to Celsius
    • Using subplots
      • Extracting seasonal temperatures
      • Finding data bounds
      • Creating our first set of subplots
  • Exercise 7
    • Cloud computing environments
    • Hints for Exercise 7
      • Labels and legends
      • Using enumerate()
      • Saving multiple plots into a directory
      • Settings for multiple subplots:
      • Preventing plot display
      • Creating an animation from multiple images
      • Creating the animation
    • NumPy-specific hints
      • Extracting seasonal dates and temperatures (in many years)
      • Finding seasonal average temperatures (by year)
Geo-Python
  • Docs »
  • Search
  • Edit on GitHub


© Copyright 2019, D. Whipp, H. Tenkanen and V. Heikinheimo, Department of Geosciences and Geography, University of Helsinki Last updated on Feb 26, 2020.

Built with Sphinx using a theme provided by Read the Docs.


Creative Commons License

Other Versions v: book-dev
Tags
2017
2018
Branches
book-dev
develop
master