Skip to main content
HomePython

Reshaping Data with pandas

4+
25 reviews
Intermediate

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 exercises17,776 learnersTrophyStatement of Accomplishment

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.
Group

Training 2 or more people?

Try DataCamp for Business

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.
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.
DataCamp for BusinessFor a bespoke solution book a demo.

In the following Tracks

Data Manipulation in Python

Go To Track

Importing & Cleaning Data in Python

Go To Track
  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
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.

In the following Tracks

Data Manipulation in Python

Go To Track

Importing & Cleaning Data in Python

Go To Track

datasets

Customer churn dataBooks dataFIFA players dataObesity data

collaborators

Collaborator's avatar
Maggie Matsui
Collaborator's avatar
Amy Peterson
Maria Eugenia Inzaugarat HeadshotMaria 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

Don’t just take our word for it

*4
from 25 reviews
56%
12%
12%
16%
4%
Sort by
  • Pascual S.
    about 2 months

    Excellent experience. I really learnt so much about Reshaping Data with Pandas.

  • Sean C.
    4 months

    I thought it was a very well taught course. Each successive chapter built on the previous chapter pretty well. I was able to solidify my understanding of the basics well at the beginning, and then was still challenged and learned a lot in the later chapters.

  • Noel C.
    4 months

    One of the best courses I have taken at DataCamp. Ten stars **********

  • Laura L.
    about 1 year

    good suggestion to refine background

  • Edwin A.
    about 1 year

    I recommend this course for those who want learn about reshaping data using pandas.

"Excellent experience. I really learnt so much about Reshaping Data with Pandas."

Pascual S.

"I thought it was a very well taught course. Each successive chapter built on the previous chapter pretty well. I was able to solidify my understanding of the basics well at the beginning, and then was still challenged and learned a lot in the later chapters."

Sean C.

"One of the best courses I have taken at DataCamp. Ten stars **********"

Noel C.

Join over 15 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.