Please enable JavaScript to use CodeHS


Data Science with Python

Lessons

  1. The Data Science Life Cycle

    1. 1.1 What is Data Science?

    2. Description

      In this lesson, students will learn what data science is, what a data scientist does, and the different types of questions that can be asked about data. Students will learn that statistical questions include computations or finding a relationship or pattern.

    3. Objective

      Students will be able to:

      • Recognize and formulate statistical questions
      • Think critically about data and its sources
    4. 1.2 Gathering Data

    5. Description

      In this lesson, students will learn about the data cycle and apply the first two steps of asking questions and considering data. Students will start a mini-project that spans through the rest of the module by asking a statistical question about a field of interest and gathering and structuring the data. They will also learn about and consider both quantitative and qualitative data.

    6. Objective

      Students will be able to:

      • Explain and apply the data cycle
      • Consider data as either quantitative or qualitative
      • Structure data into tables of rows and columns
    7. 1.3 Exploring Data Using Python

    8. Description

      In this lesson, students will learn the basics of Python programming in the context of data science. This includes how to define and use variables and lists, how to use comparison and logical operators, and the importance of knowing the different data types used in Python.

    9. Objective

      Students will be able to:

      • Use the basics of Python in the context of data science
      • Define and use variables and lists
      • Use comparison and logical operators
      • Understand the importance of the different data types used in Python
    10. 1.4 Modules, Packages & Libraries

    11. Description

      In this lesson, students will learn about Python modules and libraries and how to implement and use them within the editor.

    12. Objective

      Students will be able to:

      • Import and use Python modules and libraries
      • Explain the importance of documentation
      • Read and use documentation
    13. 1.5 Series and Central Tendency

    14. Description

      In this lesson, students will learn how to create a use a Pandas Series. They will also learn and explore measures of central tendency including the mean, median, and mode.

    15. Objective

      Students will be able to:

      • Create a Series using the Pandas library
      • Compute the mean, median, and mode of a Series
      • Decide whether the mean, median, or mode is the best measure of central tendency for a specific dataset
    16. 1.6 Measures of Spread

    17. Description

      In this lesson, students will expand their statistical knowledge to include the spread of a dataset. They will learn about and apply measures of spread including standard deviation, variance, range, and interquartile range.

    18. Objective

      Students will be able to:

      • Use functions to compute the standard deviation and variance of a Series
      • Use variables, functions, and operators to determine the range and interquartile range of a Series
      • Use functions to plot a boxplot and histogram
      • Understand what the measures of spread mean for a dataset
    19. 1.7 Pandas DataFrames

    20. Description

      In this lesson, students will learn how to create a data frame using the Pandas library. They will also learn and use functions to explore a data frame further including which data types are included, the shape of the data frame, the descriptive statistics of the data in each column, and more.

    21. Objective

      Students will be able to:

      • Create a data frame using Pandas
      • Explore a data frame using key functions
    22. 1.8 Selecting Columns

    23. Description

      In this lesson, students will learn how to filter a data frame by selecting and displaying only specific columns. They will also learn how to filter rows displayed by using conditionals. Lastly, students will learn how to change the index used in a data frame and set it to a column of their choice.

    24. Objective

      Students will be able to:

      • Filter a data frame by displaying specific columns
      • Filter a data frame using conditionals
      • Set and reset the indices of a data frame
    25. 1.9 Using Functions

    26. Description

      In this lesson, students will define and use functions, along with values in a dataset, to calculate and create new columns of data.

    27. Objective

      Students will be able to:

      • Define and use functions
      • Use existing data values to create new columns of data
    28. 1.10 Mini-Project: Findings

    29. Description

      In this lesson, students will practice collecting, explaining, and presenting the important data and details of their mini-project.

    30. Objective

      Students will be able to:

      • Interpret meaning from data
      • Extrapolate and present important details from a dataset
    31. 1.11 The Data Science Life Cycle Quiz

    32. Description

      In this lesson, students review content with a 15 question end-of-module quiz.

    33. Objective

      Students will be able to:

      • Demonstrate their understanding of Python, Pandas, and data science basics
  2. Data Science for Change

    1. 2.1 Data Science for Change

    2. Description

      In this lesson, students will explore how data is used in the social sector. They will use this information to help formulate at least three problem statements each with two statistical questions.

    3. Objective

      Students will be able to:

      • Formulate a problem statement
      • Define a statistical question regarding data in the social sector
    4. 2.2 Big Data and Bias

    5. Description

      In this lesson, students will learn about big data and cognitive biases. They will reflect on their own potential biases and work forward on their project by finding and considering datasets and further decomposing their problem statement.

    6. Objective

      Students will be able to:

      • Explain concepts of “Big Data”
      • Recognize and address cognitive biases
    7. 2.3 Importing and Filtering Data

    8. Description

      In this lesson, students will learn how to import large datasets. They will also learn how to filter a dataset using index-based selection (iloc) and label-based selection (loc).

    9. Objective

      Students will be able to:

      • Import a large dataset using a CSV file
      • Filter a dataset using iloc and loc
    10. 2.4 Conditional Filtering

    11. Description

      In this lesson, students will learn how to conditionally filter a dataset using label-based selection (loc) and comparison operators.

    12. Objective

      Students will be able to:

      • Filter a dataset using conditions and loc
    13. 2.5 Data Cleaning

    14. Description

      In this lesson, students will learn the importance of data cleaning and how to do it. Data cleaning deals with fixing or removing incorrect or missing values.

    15. Objective

      Students will be able to:

      • Use functions to explore the completeness of a dataset
      • Decide whether to drop, fix, or replace missing or incorrect data
      • Perform imputation which is the process of fixing or removing incorrect or incomplete data within a dataset
    16. 2.6 Exploring with Visualizations

    17. Description

      In this lesson, students will explore datasets using visualizations such as pie charts, boxplots, histograms, and scatterplots.

    18. Objective

      Students will be able to:

      • Explore and use data visualization functions
      • Read and interpret data visualizations
    19. 2.7 Interpret and Present

    20. Description

      In this lesson, students will work on analyzing, explaining, and presenting conclusions found in their data exploration.

    21. Objective

      Students will be able to:

      • Interpret meaning from data
      • Extrapolate and present important details from a dataset
    22. 2.8 Data Science for Change Quiz

    23. Description

      In this lesson, students review content with a 10 question end-of-module quiz.

    24. Objective

      Students will be able to:

      • Demonstrate their understanding of selection, filtering and data cleaning functions
  3. Data Storytelling

    1. 3.1 Data Storytelling

    2. Description

      In this lesson, students will learn how to use data to support and add to a story. The data story will combine visuals with a compelling narrative to help audiences understand the importance of the data being explained. This story will be told through the lens of promoting change, convincing people to take action, or compelling the readers or consumers of the data story to start a movement.

    3. Objective

      Students will be able to:

      • Create a visually appealing infographic that displays important data visualizations
      • Critically examine and reflect on various data visualizations and infographics
      • Choose an appropriate data narrative for their own data story
    4. 3.2 Data for Your Story

    5. Description

      In this lesson, students work on their module project by finding and cleaning a dataset that will help them tell their data story.

    6. Objective

      Students will be able to:

      • Gather and clean a dataset that will help create a data story
    7. 3.3 Data Visualizations

    8. Description

      In this lesson, students will learn about the importance of data visualization when telling a data story. Students will be using a variety of charts, graphs, images, and other common data visualizations to help to bring meaning and understanding to otherwise complex data.

    9. Objective

      Students will be able to:

      • Recognize and define the most common types of data visualizations
      • Debug programs that include data visualizations such as pie charts and bar graphs
    10. 3.4 Line and Bar Charts

    11. Description

      In this lesson, students will learn about univariate data and how to visualize and compare datasets using line and bar charts.

    12. Objective

      Students will be able to:

      • Plot and interpret a data visualization using a line graph
      • Plot and interpret a data visualization using a bar chart
    13. 3.5 Normal Distribution

    14. Description

      In this lesson, students will learn and use the normal distribution curve to predict the likelihood of certain events.

    15. Objective

      Students will be able to:

      • Plot a histogram and compare it to a normal distribution curve
      • Use normal distribution percentages to determine the likelihood of events.
    16. 3.6 Explore Univariate Data

    17. Description

      In this lesson, students will apply what they have learned about univariate data visualizations to explore how these may help tell their data story for the module project.

    18. Objective

      Students will be able to:

      • Explore univariate data using different data visualizations
      • Compare a histogram to a normal distribution curve
    19. 3.7 Trends and Correlations

    20. Description

      In this lesson, students will learn about correlations and causations. They will reflect on whether causation follows a correlation or if a moderating or mediating variable is responsible for the correlation.

    21. Objective

      Students will be able to:

      • Use a function to find correlation
      • Determine whether a correlation leads to a causation
      • Reflect on moderating and mediating variables as they relate to correlation
    22. 3.8 Linear Regression

    23. Description

      In this lesson, students will learn and apply aspects of linear regression such as finding the line of best fit and using a model to predict the outcome to different values.

    24. Objective

      Students will be able to:

      • Determine the line of best fit model for a scatterplot
      • Use a model to make predictions based on different values
    25. 3.9 Explore Bivariate Data

    26. Description

      In this lesson, students will apply what they have learned about bivariate data visualizations to explore how these may help tell their data story for the module project.

    27. Objective

      Students will be able to:

      • Explore bivariate data using a scatterplot
      • Determine correlation and use linear regression when applicable
    28. 3.10 Telling Your Story

    29. Description

      In this lesson, students will work on their module projects by applying what they have learned to create a data story.

    30. Objective

      Students will be able to:

      • Use data visualizations, analysis, and interpretation to create a data story
    31. 3.11 Data Storytelling Quiz

    32. Description

      In this lesson, students review content with a 10 question end-of-module quiz.

    33. Objective

      Students will be able to:

      • Demonstrate their understanding of data storytelling
  4. Data Science for Business

    1. 4.1 Data Science for Business

    2. Description

      In this lesson, students will be introduced to the module project. They will take a look at how the data is used in the business world to improve aspects of the business as well as predict future outcomes.

    3. Objective

      Students will be able to:

      • Explain the benefits of data analytics in the business world
    4. 4.2 Quality Datasets

    5. Description

      In this lesson, students will learn how to determine the quality of a dataset. They will explore a few raw datasets to access their quality and completeness.

    6. Objective

      Students will be able to:

      • Use functions to determine a dataset’s completeness
      • Use functions and a library to check a dataset’s validity and accuracy
    7. 4.3 Aggregating Data

    8. Description

      In this lesson, students will practice aggregating data by using different sort and group functions and parameters.

    9. Objective

      Students will be able to:

      • Group and sort datasets and reflect on the results
      • Sort by multiple columns and analyze and interpret the results
    10. 4.4 Combining Datasets

    11. Description

      In this lesson, students will practice combining data by using different concatenation and merging techniques.

    12. Objective

      Students will be able to:

      • Concatenate two datasets
      • Explain different merge/join methods and determine which method is best given a scenario
      • Use merge/join functions to combine two datasets
    13. 4.5 Your Business Data

    14. Description

      In this lesson, students will work on their module projects by gathering and combining data from multiple sources. They will check the quality of the datasets as well as clean, combine and sort them.

    15. Objective

      Students will be able to:

      • Assess the quality of data sources and data sets
      • Clean and combine multiple datasets
    16. 4.6 Bias in Data Analytics

    17. Description

      In this lesson, students will learn different types of bias that can be present and affect data analytics. They will also take time to analyze and interpret their project datasets.

    18. Objective

      Students will be able to:

      • Explain and recognize different types of bias that can be present during data analysis and interpretation
    19. 4.7 Business Report

    20. Description

      In this lesson, students will work on their module projects by creating a business report.

    21. Objective

      Students will be able to:

      • Create and present a business report based on data analysis and interpretation
    22. 4.8 Data Science for Business Quiz

    23. Description

      In this lesson, students review content with a 10 question end-of-module quiz.

    24. Objective

      Students will be able to:

      • Demonstrate their understanding of data aggregation
  5. Final Exam

    1. 5.1 Final Exam

    2. Description
    3. Objective
  6. What's Next?

    1. 6.1 What's Next?

    2. Description
    3. Objective
  7. Basic Python Bootcamp

    1. 7.1 Printing in Python

    2. Description

      In this lesson, you’ll learn how to make the most basic python program, one that displays texts on the screen. When you run these programs, you’ll see text appear on the console screen. You will learn how to print in python using the print statement. You will also learn how to use quotations, apostrophes, and strings.

    3. Objective

      Students learn how to print text in Python.

    4. 7.2 Variables and Types

    5. Description

      In this video, students will learn about a fundamental aspect of every programming language: Variables. A variable is something that stores information in a program that you can use later. More specifically, a variable has 3 things: a name, type, and value. One of the variables students will be presented is Greeting.

    6. Objective

      SWBAT define Python variables and types.

    7. 7.3 User Input

    8. Description

      In this lesson, we cover user input. We learn how to request user input as both strings and integers, we learn where the input is stored, and we learn how to convert strings and integers. By converting strings to integers, students can incorporate their knowledge from the previous lesson (Mathematical Operators) with this lesson on user input.

    9. Objective

      SWBAT incorporate user input into their programs.

    10. 7.4 Mathematical Operators

    11. Description

      In this lesson, students will learn about using mathematical operators in their Python programs. They will work through multiple examples to get comfortable with operator precedence and using different types of operators.

    12. Objective

      Students will be able to:

      • Describe the different mathematical operators that can be used in their programs
      • Create programs that use basic math to compute useful things
      • Create programs that take in user input, do simple computations with the input, and produce useful output
    13. 7.5 String Operators

    14. Description

      In this lesson, students will be able to perform string operations in order to concatenate values together.

    15. Objective

      Students will be able to:

      • Use mathematical operators with strings
    16. 7.6 Booleans

    17. Description

      In this lesson we will discuss what is a Boolean and go over examples.

    18. Objective

      Students learn about booleans and how they might be useful in their programs.

    19. 7.7 If Statements

    20. Description

      In this lesson we will learn how to use If and If-Else Statements; these statements allow you to use conditions to determine how your code should run.

    21. Objective

      Students learn how to use if statements for control flow in their programs.

    22. 7.8 Comparison Operators

    23. Description

      In this lesson, students will dive into comparison operators. Comparison operators give the ability to compare two values. Using comparison operators in programming is similar to math in that less than <, greater than >, less than or equal to <=, and greater than or equal to >= are the same. The differences are that operators for equal to are == and not equal are !=. Using comparison operators allow programs to make decisions.

    24. Objective

      Students will be able to:

      • Explain the meaning of each of the comparison operators (<, <=, >, >=, ==, !=)
      • Create programs using the comparison operators to compare values
      • Predict the boolean result of comparing two values
      • Print out the boolean result of comparing values
    25. 7.9 Logical Operators

    26. Description

      In this lesson, students will look at logical operators. Logical operators give the ability to connect or modify Boolean expressions. Three logical operators are NOT (!), or and and. These logical operators can be used in combination. With these logical operators, logical statements can be constructed, such as “I go to sleep when I am tired OR it’s after 9pm”, “I wear flip flops when I am outside AND it is NOT raining”.

    27. Objective

      Students will be able to:

      • Describe the meaning and usage of each logical operator: or, and, and NOT (!)
      • Construct logical statements using boolean variables and logical operators
    28. 7.10 While Loops

    29. Description
      • While loops allow code to be executed repeatedly based on a condition.
      • It might be helpful to think of while loops as a repeating if statement.
      • Infinite loops are created if the exit condition of the while loop is never met, causing the code inside the while loop to repeat continuously.
    30. Objective

      Students learn how to effectively use while loops in their programs and to watch out for infinite loops.

    31. 7.11 For Loops

    32. Description

      In this lesson, students will explore how to use for loops in their Python programs. They will be reminded how to use i as a variable in their programs as well as how to control the values of i by altering the starting, ending, and interval values.

    33. Objective

      Students will be able to:

      • Implement for loops
      • Use the variable i as a counter
      • Control the values of i in a for loop
    34. 7.12 Break and Continue

    35. Description

      In this lesson, students learn about break and continue statements. A break statement is used to immediately terminates a loop. A continue statement is used to skip out of future commands inside a loop and return back to the top of the loop. These statements can be used with for or while loops.

    36. Objective

      Students will be able to:

      • Explain the critical difference between break and continue
      • Describe why a break or continue statement would be needed in a coding scenario
    37. 7.13 Nested Control Structures

    38. Description
      • When we use control structures within control structures, we refer to them as nested control structures.
      • When using a for loop within a for loop, we need to be careful to create a second variable to index on.
      • The inner loop will run to completion every time the outer loop runs.
    39. Objective

      Students build upon their control structures knowledge to start using nested control structures in their programs.

    40. 7.14 Functions

    41. Description

      In this lesson, we learn about Functions. Functions let us break our program into different parts that we can organize and reuse however we like. Functions are the main building block of complex Python programs.

    42. Objective

      Students will be able to:

      • modularize their programs with functions
    43. 7.15 Functions and Parameters

    44. Description

      In this lesson, we dive deeper into the concept of functions by exploring how to use parameters.

    45. Objective

      Students will be able to:

      • Effectively use parameters to customize functions in their programs
    46. 7.16 Namespaces in Functions

    47. Description

      In this lesson, we explore where variables exist and what the difference is between a local and global variable.

    48. Objective

      Students will be able to:

      • describe the different namespaces with regards to variables and functions
    49. 7.17 Functions and Return Values

    50. Description

      In this lesson, students explore functions with return values and deepen their understanding of and ability to use functions.

    51. Objective

      Students will be able to:

      • remove complexity from their programs by abstracting with functions
      • generalize their functions with parameters
      • chain functions together using return values
    52. 7.18 Exceptions

    53. Description

      In this lesson, students explore Python’s way of handling errors with exceptions.

    54. Objective

      Students will be able to:

      • create programs that can gracefully handle exceptions
      • continue to function when an error is raised