Introduction
Grouping
Summary
17. Summary

Instruction

It's time to wrap things up. Here's what we learned:

  1. Some basic statistical functions you can use in pandas are:

    • describe() – shows multiple basic statistics,
    • count() – counts the number of non-empty values,
    • sum() – calculates the total sum,
    • min() / max() – finds the minimum/maximum value, respectively,
    • std() – calculates the standard deviation,
    • mean() – calculates the mean value,
    • quantile(...) – calculates specified quantiles:
      quantile([0.25,0.5,0.75])
      will calculate 1st, 2nd and 3rd quartiles
  2. To group rows by a single column, use
    dataFrame.groupby('column')
  3. To group rows by multiple columns, use
    dataFrame.groupby(['column1','column2'...])
  4. The size() function shows the number of rows in each group.
  5. You can access columns in grouped rows using square brackets: grouped['column'].
  6. You can use statistical functions and sorting with grouped rows. For example:
    grouped['aces'].mean().sort_values(ascending=False)

Alright, how about a short quiz now?

Exercise

Click Next exercise to continue.