df = pandas.DataFrame({'a': np.random.random(100), 'b': np.random.random(
    100) + 10})
bins = np.linspace(df.a.min(), df.a.max(), 10)
groups = df.groupby(pandas.cut(df.a, bins))
print(groups.mean().b)
binning a dataframe in pandas in Python