Chapter 21

Data Manipulation

Learning Objectives

After completing all of the content in this chapter, you should be able to do the following:

  1. Aggregate data accross multiple columns (mean, median, mode)
  2. Append data: stack or concatenate multiple datasets with the .concat function
  3. Recode and map values within a column to new values by providing conditional formatting
  4. Group data together with the .groupby function
  5. Merge columns together based on the provided column or indices
  6. Restructure data long vs. wide with pandas melt and pivot functionality

Key Terminology

Aggregation

  1. GroupBy

Recoding Data

  1. .replace()
  2. .apply()

Reshaping Tables

  1. .melt()
  2. .concat()
  3. .sort_values()
  4. wide format
  5. long format