This file contains hidden or 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
| { | |
| "metadata": { | |
| "name": "", | |
| "signature": "sha256:50c3d72f03b2ec97ee24d9e5a4f27faa1a48d7fe209616e378edc70f146f845b" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ |
This file contains hidden or 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
| { | |
| "metadata": { | |
| "name": "", | |
| "signature": "sha256:9c901b87c21a76e998af9a7e0bf41fad4ba1df839faeac70481cbcb4124e7289" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """ | |
| Sample report generation script from pbpython.com | |
| This program takes an input Excel file, reads it and turns it into a | |
| pivot table. | |
| The output is saved in multiple tabs in a new Excel file. | |
| """ |
This file contains hidden or 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
| g = simuls.groupby('Team') | |
| season_hdis = pd.DataFrame({'points_lower': g.points.quantile(.05), | |
| 'points_upper': g.points.quantile(.95), | |
| 'goals_for_lower': g.gf.quantile(.05), | |
| 'goals_for_median': g.gf.median(), | |
| 'goals_for_upper': g.gf.quantile(.95), | |
| 'goals_against_lower': g.ga.quantile(.05), | |
| 'goals_against_upper': g.ga.quantile(.95), | |
| }) | |
| season_hdis = pd.merge(season_hdis, df_observed, left_index=True, right_on='Team') |
This file contains hidden or 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
| df_avg = pd.DataFrame({'avg_att': atts.stats()['mean'], | |
| 'avg_def': defs.stats()['mean']}, | |
| index=teams.team.values) | |
| df_avg = pd.merge(df_avg, df_observed, left_index=True, right_on='team', how='left') | |
| fig, ax = plt.subplots(figsize=(8,6)) | |
| for outcome in ['winner', 'triple_crown', 'wooden_spooon', '']: | |
| ax.plot(df_avg.avg_att[df_avg.QR == outcome], | |
| df_avg.avg_def[df_avg.QR == outcome], 'o', label=outcome) | |
This file contains hidden or 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
| df_hpd = pd.DataFrame(atts.stats()['95% HPD interval'], | |
| columns=['hpd_low', 'hpd_high'], | |
| index=teams.team.values) | |
| df_median = pd.DataFrame(atts.stats()['quantiles'][50], | |
| columns=['hpd_median'], | |
| index=teams.team.values) | |
| df_hpd = df_hpd.join(df_median) | |
| df_hpd['relative_lower'] = df_hpd.hpd_median - df_hpd.hpd_low | |
| df_hpd['relative_upper'] = df_hpd.hpd_high - df_hpd.hpd_median | |
| df_hpd = df_hpd.sort_index(by='hpd_median') |
This file contains hidden or 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
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "slideshow": { | |
| "slide_type": "slide" | |
| } | |
| }, | |
| "source": [ |
This file contains hidden or 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
| docker-machine create \ | |
| --driver amazonec2 \ | |
| --amazonec2-access-key $ACCESS_KEY \ | |
| --amazonec2-secret-key $SECRET_KEY \ | |
| --amazonec2-vpc-id $VPC \ | |
| --amazonec2-security-group $SECURITY_GROUP \ | |
| --amazonec2-instance-type "m4.2xlarge" \ | |
| --amazonec2-root-size 20 \ | |
| --amazonec2-request-spot-instance \ | |
| --amazonec2-spot-price 0.20 \ |
This file contains hidden or 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
| LC_ALL=C docker-machine create \ | |
| --driver amazonec2 \ | |
| --amazonec2-access-key $AWS_ACCESS_KEY_ID \ | |
| --amazonec2-secret-key $AWS_SECRET_ACCESS_KEY \ | |
| --amazonec2-region "eu-west-1" \ | |
| --amazonec2-vpc-id $VPC \ | |
| --amazonec2-instance-type "m4.2xlarge" \ | |
| --amazonec2-root-size 20 \ | |
| --amazonec2-request-spot-instance \ | |
| --amazonec2-spot-price 0.20 \ |
This file contains hidden or 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
| from pylab import * | |
| from scipy.stats import * | |
| num_adults = 227e6 | |
| basic_income = 7.25*40*50 | |
| labor_force = 154e6 | |
| disabled_adults = 21e6 | |
| current_wealth_transfers = 3369e9 | |
| def jk_rowling(num_non_workers): |