...

/

Split-Apply-Combine Technique

Split-Apply-Combine Technique

In this lesson, the split-apply-combine can be found of pandas is discussed.

Split-Apply-Combine method

In this technique, we split the data into specific groups, like in the previous lesson. Then certain operations are applied to those groups separately. Finally, all the groups are again combined to form the final required dataset. Let’s review the following example.

The initial data set is first split into three groups, A, B, and C. Then, the sum operation is applied to every element of each group. Finally, the results are combined at the end, and a dataset with concise required information is formed.

Let’s perform this technique on air quality index data and see what type of useful information can be extracted.

Press + to interact
import pandas as pd
df = pd.read_csv('air.csv') # reading data from file
print(df)

As can be seen from the ...

Access this course and 1400+ top-rated courses and projects.