Skip to content

Instantly share code, notes, and snippets.

@tengpeng
Created January 31, 2016 03:17
Show Gist options
  • Save tengpeng/a439b41a1e4c935b1b22 to your computer and use it in GitHub Desktop.
Save tengpeng/a439b41a1e4c935b1b22 to your computer and use it in GitHub Desktop.
test
import numpy
#data = numpy.random.random(100)
bins = numpy.linspace(15, 100, 5)
group_names = ['1', '2', '3', '4','5']
#digitized = numpy.digitize(df_all['age'], bins)
categories = pd.cut(df_all['age'], bins, labels=group_names)
df['categories'] = pd.cut(df['postTestScore'], bins, labels=group_names)
categories
#bin_means = [data[digitized == i].mean() for i in range(1, len(bins))]
#df_all['age']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment