Get it from the App Store.
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
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| import re | |
| def findBlockWithString(string, childtag, contentattrs, soup): | |
| """Finds tag within a block of HTML, using a string search. It goes through 3 steps: | |
| it finds the 'tag' that includes the 'string' we're looking for, within the soup defined | |
| by the program, then finds the parent HTML tag. Finally it finds the tag wanted | |
| using the tag attribute, "contentattrs". | |
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
| import csv, ast, re | |
| with open("/Users/rackerman/Projects/provider directory scrapers/d2h_listings.txt") as infile: | |
| listings = ast.literal_eval(infile.read()) | |
| with open("/Users/rackerman/Projects/provider directory scrapers/d2h.csv", "w") as outfile: | |
| fieldnames = ["Program Contact", "Program/Facility Location", "Total Number of Units", | |
| "Housing Type", "Services", "Location(s)", "Sobriety Requirement", "Populations served", | |
| "Eligibility requirements", "How to apply", "Required documents", "Additional information"] | |
| outfile.write(u'\ufeff'.encode('utf8')) # BOM (optional...Excel needs it to open UTF-8 file properly) |
PEAR doesn't work immediately, even if you're working with the PEAR rolled in with MAMP. Make sure to change these things, as they are originally set to use usr/bin or usr/lib:
PEAR executables directory bin_dir /Applications/MAMP/bin/php/php5.4.4/binPEAR documentation directory doc_dir /Applications/MAMP/bin/php/php5.4.4/lib/php/docPHP extension directory ext_dir /Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525PEAR directory php_dir /Applications/MAMP/bin/php/php5.4.4/lib/php
Configuration (channel pear.php.net): ===================================== Auto-discover new Channels auto_discover 1
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
| def get_dict_keys(url): | |
| keys = [] | |
| op = s.urlopen(url) | |
| bs = BeautifulSoup(op) | |
| keys_th = bs.find('table', class_ = 'intv').find('tr').find_all('th') | |
| [keys.append(key.string) for key in keys_th] | |
| print keys | |
| keys |
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
| # as.numeric prevented weird row names, for some reason | |
| SumStats <- function(df){ | |
| out <- data.frame(row.names = FALSE) | |
| for (name in names(df)[2:length(names(df))]) { | |
| min = as.numeric(min(df[[name]])) | |
| p20 = as.numeric(quantile(df[[name]], probs=0.20, na.rm=TRUE)) | |
| mean = as.numeric(mean(df[[name]])) | |
| median = as.numeric(median(df[[name]])) |
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
| import pandas as pd | |
| import numpy as np | |
| # for text columns A and B | |
| df['rel'] = '' | |
| df.ix[(df.A == df.B), 'rel'] = df.A | |
| df.ix[(df.A != df.B), 'rel'] = df.A + "/" + df.B | |
| # for number columns A and B | |
| df['rel'] = np.nan |
- Created AWS account, then IAM account and S3 bucket.
- Gave IAM access to the S3 bucket via the user page
https://console.aws.amazon.com/iam/home#users/<username>/attachPolicy - Copied
app/assets/imagesandapp/assets/csv - Added CORS
OlderNewer