From the course: Fundamentals of Data Transformation for Data Engineering

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

Order and aggregate

Order and aggregate

- [Instructor] So now we'll talk about ordering and aggregating data using Pandas and it's a bit different than SQL, so stay tuned here. Some of this might look familiar, some of it might not. We're going to load again our parks dataframe, which we should all be pretty familiar with at this point. And the core of the Pandas grouping functionality, this might be a little bit familiar to SQL, is the group by method, which groups our data and how things work is similar to SQL. Like you'll notice some similarities. The syntax is definitely not and it can be confusing. So note that here there is a bit of a Pythonic twist, right? And we're going to specify first the columns that we want to group by and then the column that we want to count, right? So we're going to group by the state's column and now we have states grouped by, but we need to specify a column to count. And so when I run this and we're going to get our states as well as the count, I just feel, you know, as an outsider looking…

Contents