Geo-Python Logo
2018.1

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
    • How to find out which conda -command to use when installing a package?
      • The easiest way
      • 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
    • Jupyter Notebooks and JupyterLab
    • Using your own computer
    • Cloud computing environments
      • Binder
      • CSC Notebooks
    • Git + GitHub
    • Using Slack
    • Voting and polling
    • Page summary
  • Communicating with Slack
    • Overview of Slack
    • Activating your account
    • Basic usage of Slack
      • Notifying a user
      • Using threads
    • General guidelines for communication
  • A taste of Python
    • Sources
    • About this document
      • Getting started
      • Variables, arithmetic and modules
    • Simple Python math
    • Functions
    • Math operations
    • Combining functions
    • Variables
    • Updating variables
    • Variable values
    • Data types
  • Exercise 1
    • Part 1 - Creating a GitHub.com account and using Slack
    • Part 2 - Cooking up some Python
    • What to submit

Lesson 2

  • Lesson overview
    • Learning goals
    • Lecture video
  • Introduction to Version Control and GitHub
    • Familiar?
    • What is version control?
    • Why to use it?
    • Basic vocabulary of Version Control
    • What is GitHub?
      • Relies on Git
      • Social (collaborative) network
      • Open source / science
      • Documentation
      • Online tools
      • Issue tracking
    • Resources
  • Meet Git
    • Clone a repository from GitHub
    • Add changes
    • Commit changes
    • Synchronize changes
    • Configuration
  • Using Classroom for Github
    • Classroom for GitHub
  • 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
      • The concept of objects
      • A (bad) example of methods
      • Some other useful list methods
      • Reversing a list
      • Sorting a list
      • List attributes
  • Exercise 2
    • Exercise 2 hints
      • 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
      • Another for loop example
      • for loop variables
      • for loops and lists
        • Poll question pause
      • Calculating values in for loops
      • Looping over the length of lists
        • Poll question pause
  • Conditional statements
    • Sources
    • Basics of conditional statements
      • A simple conditional statement
        • A familiar conditional scenario
      • else is not required
      • Introducing second test
        • Poll question pause
      • Combining conditions
        • Another familiar conditional scenario
  • Exercise 3
    • Exercise 3 hints
      • General tips
      • Combining strings
      • Nested if statements

Lesson 4

  • Lesson overview
    • Learning goals
    • 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
    • What is a module?
    • How can modules be loaded?
      • Loading a module
      • Renaming imported modules
      • Importing a single function
      • Importing part of a module
    • How can modules be used?
    • What should I not do?
      • from X import *
      • Poor names when renaming on import
  • 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
    • Exercise 4 hints
      • Importing variables from a script
      • Counting values from a list

Lesson 5

  • Lesson overview
    • Learning goals
    • Lecture videos
      • Pandas
      • NumPy
  • Pandas lesson
    • 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
      • Preparations for this lesson (working environment and input data)
      • Reading a data file with Pandas
      • Exploring our dataset
    • Processing data with Pandas
      • Calculating with DataFrames
      • Selecting data using indices
      • Filtering and updating data
      • Dealing with missing data
      • Sorting data
      • Rounding and finding unique values
      • Writing data
  • NumPy lesson
    • Exploring data using NumPy
      • What is NumPy?
      • Preparation (the key to success)
      • Reading a data file with NumPy
        • Importing NumPy
        • Reading a data file
        • Inspecting our data file
        • Reading our data file, round 2
      • Exploring our dataset
        • Checking the array data type
        • Checking the data array type
        • Checking the size of the dataset
        • Working with our data - Index slicing
        • Slicing our data into columns
        • Checking the data in memory
        • Basic data calculations in NumPy
        • Data type conversions
    • Processing data with NumPy
      • Calculating with NumPy arrays
        • Creating arrays
        • Calcuating values using other arrays
      • Filtering data
        • Using data masks
      • Removing missing/bad data
      • Rounding and finding unique values
        • Finding unique values
      • Saving our data to a file
        • Re-creating our 2D data array
        • Saving our data
  • Exercise 5
    • Exercise 5 hints for Pandas
    • Exercise 5 hints for NumPy
      • Formatting output to written to files

Lesson 6

  • Lesson overview
    • Learning goals
    • Lesson videos
  • Pandas lesson
    • Advanced data processing with Pandas
      • Reading the data
      • Exploring data and renaming columns
      • Iterating rows and using self-made functions in Pandas
      • String manipulation in Pandas
      • Aggregating data in Pandas by grouping
      • Finding outliers from the data
      • Repeating the data analysis with larger dataset
  • NumPy lesson
    • Advanced data processing with NumPy
      • Getting started
        • Previewing the data file.
        • Importing NumPy and loading the data
        • Converting the missing data to nan values
        • Splitting the data into column arrays
      • Examining our data
        • Basic observations
        • Checking for missing/bad data
      • Calculations within a date range
        • Removing missing data
        • Average annual temperature, method 1
        • Average monthly temperatures
      • Splitting dates into separate year, month, and day
        • Splitting a single date string
        • Splitting dates in a NumPy array
      • Finding averages in a date range
        • Finding the average monthly max temperature
        • Using functions on NumPy array data
        • Computing monthly average temperatures for a range of years
        • Calculating temperature anomalies
  • Dealing with errors
    • Interpreting error messages
      • Common errors and exceptions
      • Reading error messages
    • Assertions
      • More information
  • Debugging Python scripts
    • 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
    • Exercise 6 hints for Pandas
      • 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
    • Exercise 6 hints for NumPy
      • Calculating average temperatures for each month (e.g., February 1954)
      • Calculating average temperatures for all months (e.g., February 1952-1980)
      • Calculating temperatures anomalies
      • Checking your work for problem 2
      • Checking your work for problem 3

Lesson 7

  • Lesson overview
    • Learning goals
    • Lesson videos
  • Plotting in Python
  • Anatomy of a plot
    • Common terms when doing plotting
  • Plotting with Matplotlib
    • Our dataset
    • Getting started
      • Loading the data with NumPy
      • Loading the data with Pandas
    • Our first plot
    • Basic plot formatting
      • Embiggening* the plot
      • Adding text labels to a plot
      • Changing the axis ranges
    • Bar plots in Matplotlib
    • Saving your plots as image files
  • More advanced plotting with Matplotlib
    • The dataset
    • Getting started
      • Loading the data using NumPy
      • Loading the data using Pandas
    • Preparing the data
      • Converting temperatures to Celsius
    • Using subplots
      • Extracting seasonal temperatures
      • Finding data bounds
      • Creating our first set of subplots
      • Converting our date string to dates for Matplotlib plotting
  • Exercise 7
    • Hints for Exercise 7
      • Labels and legends
      • Using enumerate()
      • Saving multiple plots into a directory
      • 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 »
  • Pandas lesson
  • Edit on GitHub

Pandas lesson¶

Below you will find links to the Lesson 5 materials based on using Pandas. These materials are intended for students continuing on to the Automating GIS processes course.

  • 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
    • Preparations for this lesson (working environment and input data)
    • Reading a data file with Pandas
    • Exploring our dataset
  • Processing data with Pandas
    • Calculating with DataFrames
    • Selecting data using indices
    • Filtering and updating data
    • Dealing with missing data
    • Sorting data
    • Rounding and finding unique values
    • Writing data
Next Previous

© Copyright 2018, D. Whipp, H. Tenkanen and V. Heikinheimo, Department of Geosciences and Geography, University of Helsinki Revision aa07b995.

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


Creative Commons License

Read the Docs v: 2018.1
Versions
latest
stable
2019.1
2018.1
2017.1
develop
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.