Skip to main content

Reshaping Data with pandas

Reshape DataFrames from a wide to long format, stack and unstack rows and columns, and wrangle multi-index DataFrames.

Start Course for Free
4 Hours15 Videos52 Exercises8,349 Learners4450 XPImporting & Cleaning Data Track

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Loved by learners at thousands of companies


Course Description

Often data is in a human-readable format, but it’s not suitable for data analysis. This is where pandas can help—it’s a powerful tool for reshaping DataFrames into different formats. In this course, you’ll grow your data scientist and analyst skills as you learn how to wrangle string columns and nested data contained in a DataFrame. You’ll work with real-world data, including FIFA player ratings, book reviews, and churn analysis data, as you learn how to reshape a DataFrame from wide to long format, stack and unstack rows and columns, and get descriptive statistics of a multi-index DataFrame.
  1. 1

    Introduction to Data Reshaping

    Free

    Let's start by understanding the concept of wide and long formats and the advantages of using each of them. You’ll then learn how to pivot data from long to a wide format, and get summary statistics from a large DataFrame.

    Play Chapter Now
    Wide and long data formats
    50 xp
    The long and the wide
    100 xp
    Flipping players
    100 xp
    Reshaping using pivot method
    50 xp
    Dribbling the pivot method
    100 xp
    Offensive or defensive player?
    100 xp
    Replay that last move!
    100 xp
    Pivot tables
    50 xp
    Reviewing the moves
    100 xp
    Exploring the big match
    100 xp
    The tallest and the heaviest
    100 xp
  2. 2

    Converting Between Wide and Long Format

    Master the technique of reshaping DataFrames from wide to long format. In this chapter, you'll learn how to use the melting method and wide to long function before discovering how to handle string columns by concatenating or splitting them.

    Play Chapter Now
  3. 3

    Stacking and Unstacking DataFrames

    In this chapter, you’ll level-up your data manipulation skills using multi-level indexing. You'll learn how to reshape DataFrames by rearranging levels of the row indexes to the column axis, or vice versa. You'll also gain the skills you need to handle missing data generated in the stacking and unstacking processes.

    Play Chapter Now

In the following tracks

Importing & Cleaning Data

Collaborators

maggiematsui
Maggie Matsui
amy-4121b590-cc52-442a-9779-03eb58089e08
Amy Peterson
Maria Eugenia Inzaugarat Headshot

Maria Eugenia Inzaugarat

Data Scientist and Artificial Intelligence Consultant

Eugenia is a passionate, dedicated, and proactive data scientist and Artificial Intelligence Consultant that enjoys not only doing machine learning projects but also telling stories with data. She obtained a Ph.D. from the University of Buenos Aires. She has taught university courses in mathematics and biology as well as online courses on Data Science. Having transitioned from an academic background into data science, Eugenia loves teaching concepts related to python programming, data science, and machine learning to help others also gain knowledge about these fields.
See More

What do other learners have to say?

Join over 10 million learners and start Reshaping Data with pandas today!

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.