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
| #!/bin/bash | |
| # | |
| # Starts a local private Docker Registry | |
| # with self-signed SSL cert | |
| # | |
| # Graham Daley | |
| # License: GPL | |
| cat <<EOF > /tmp/openssl.cnf | |
| # From http://apetec.com/support/GenerateSAN-CSR.htm |
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
| #!/usr/bin/python | |
| import pandas as pd | |
| df = pd.read_csv('nytimes_in.csv') | |
| group_cols = ['Age', 'Gender', 'Signed_In'] | |
| all_cols = group_cols + ['Clicks', 'Impressions'] | |
| dfg = df[all_cols].groupby(group_cols).agg([np.mean]) | |
| dfg['Click_Thru_Mean'] = dfg['Clicks'] / dfg['Impressions'] | |
| dfg = dfg.drop(['Clicks', 'Impressions'], axis=1) | |
| dfg.to_csv('nytimes_aggregation.csv') |
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
| #!/usr/bin/python | |
| # Import required libraries | |
| import sys | |
| # Start a impressionser and store the textfile in memory | |
| results = {} | |
| default_record = {'count': 0, 'total_clicks': 0.0, 'total_impressions': 0.0, 'max_clicks': 0, 'max_impressions': 0} | |
| lines = sys.stdin.readlines() | |
| lines.pop(0) |
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
| #!/usr/bin/python | |
| # Data Science Lesson 1 | |
| # Graham Daley | |
| # Import required libraries | |
| import sys | |
| # Start a impressionser and store the textfile in memory | |
| impressions = 0 | |
| total_age = 0.0 |