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 Exercises10,833 Learners
Create Your Free Account
Loved by learners at thousands of companies
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.
Introduction to Data ReshapingFree
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.Wide and long data formats50 xpThe long and the wide100 xpFlipping players100 xpReshaping using pivot method50 xpDribbling the pivot method100 xpOffensive or defensive player?100 xpReplay that last move!100 xpPivot tables50 xpReviewing the moves100 xpExploring the big match100 xpThe tallest and the heaviest100 xp
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.Reshaping with melt50 xpGothic times100 xpRating is not everything100 xpHow is Frankenstein, Dorian Gray?100 xpWide to long function50 xpThe golden age100 xpDecrypting the code100 xpTime to read, Katniss!100 xpWorking with string columns50 xpDid you say dystopia?100 xpWhat's your rating, Harry?100 xpElementary, dear Watson!100 xp
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.Stacking DataFrames50 xpStack the calls!100 xpPhone directory index100 xpText me!100 xpUnstacking DataFrames50 xpInternational caller100 xpCall another time100 xpOrganizing your voicemail100 xpWorking with multiple levels50 xpSwap your SIM card100 xpTwo many calls100 xpHandling missing data50 xpA missed phone call100 xpDon't drop the stack100 xp
You'll finish by learning how to combine the reshaping process with grouping to produce quick data manipulations. Lastly, you'll discover how to transform list-like columns and handle complex nested data, such as nested JSON files.Reshaping and combining data50 xpLess fast food, please!100 xpOnly going up100 xpA group analysis100 xpTransforming a list-like column50 xpMerge it all100 xpExplode the bounds100 xpThe good old split100 xpReading nested data into a DataFrame50 xpNested movies100 xpA complex film100 xpDealing with nested data columns50 xpUn-nesting birds100 xpDon't dump the bird100 xpThe final reshape50 xp
In the following tracksData Manipulation with PythonImporting & Cleaning Data with Python
PrerequisitesData Manipulation with pandas
Maria Eugenia InzaugaratSee More
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.
Don’t just take our word for it
*4from 11 reviews
- Helmut D.6 days
- Andreas N.19 days
Great to follow and a lot learned!
- Evgeni N.about 1 month
I have leared a lot!
- José C.4 months
- Ramana T.4 months
Very good slides and exercises. Very ready to remember the content.
"Great to follow and a lot learned!"
"I have leared a lot!"
Join over 11 million learners and start Reshaping Data with pandas today!
Create Your Free Account