Created
October 14, 2015 19:41
-
-
Save philkuz/5bb653edd32321f9fa22 to your computer and use it in GitHub Desktop.
The histogram overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#=============EXAMPLE=============== | |
def compare(t, conditions, values): | |
"""Overlay histograms of values for two conditions.""" | |
t['count'] = 1 | |
e = t.pivot(conditions, values, 'count', sum) | |
for label in e.column_labels[1:]: | |
e[label] = e[label]/sum(e[label]) # Normalize each column of counts | |
e.hist(counts=values, normed=True, overlay=True) | |
compare(couples, 'mar_status', 'age') | |
#=============ACTUAL=============== | |
# sample the larger table to the smaller table size | |
# align |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment