O'Reilly logo

Mastering pandas by Femi Anthony

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Operations in pandas, Part II – Grouping, Merging, and Reshaping of Data

In this chapter, we tackle the question of rearranging data in our data structures. We examine the various functions that enable us to rearrange data by utilizing them on real-world datasets. Such functions include groupby, concat, aggregate, append, and so on. The topics that we'll discuss are as follow:

  • Aggregation/grouping of data
  • Merging and concatenating data
  • Reshaping data

Grouping of data

We often detail granular data that we wish to aggregate or combine based on a grouping variable. We will illustrate some ways of doing this in the following sections.

The groupby operation

The groupby operation can be thought of as part of a process that involves the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required