5 Group By: split-apply-combine

In [1]: import numpy as np

In [2]: np.random.seed(123456)

In [3]: np.set_printoptions(precision=4, suppress=True)

In [4]: import pandas as pd

In [5]: pd.options.display.max_rows = 8

In [6]: import matplotlib

In [7]: matplotlib.style.use('ggplot')

In [8]: import matplotlib.pyplot as plt

In [9]: plt.close('all')

In [10]: from collections import OrderedDict