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
SELECT | |
body, created_utc, score, author | |
FROM [fh-bigquery:reddit_comments.all] | |
WHERE subreddit = "ApplyingToCollege" | |
AND (LOWER(body) LIKE LOWER("% Princeton University %") | |
OR LOWER(body) LIKE LOWER("% princeton %") | |
OR LOWER(body) LIKE LOWER("% Harvard University %") | |
OR LOWER(body) LIKE LOWER("% harvard %") |
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 sys | |
# sys.setdefaultencoding() does not exist, here! | |
reload(sys) # Reload does the trick! | |
sys.setdefaultencoding('UTF8') | |
import json | |
import glob | |
import traceback | |
DB = {"Total": 0} | |
finalList = {} | |
listF = [] |
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 requests | |
import bs4 | |
import re | |
import json | |
from textblob import TextBlob | |
def getLyricSentiment(lyrics): | |
lyrics = re.sub('\s+',' ',lyrics) | |
return TextBlob(lyrics).sentiment.polarity |
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 sys | |
reload(sys) | |
sys.setdefaultencoding("utf-8") | |
import requests | |
import bs4 | |
import zipcode | |
import threading | |
import re | |
import json | |
import time |
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 requests | |
import bs4 | |
import json | |
DB = [] | |
def grabSite(url): | |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'} | |
return requests.get(url, headers=headers, timeout=10) |
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 json | |
SAT_2017_TAKERS = 1715481 | |
def inverse(): | |
for key, value in satListz.items(): | |
value = int(value) | |
key = int(key) | |
if value not in flipped: | |
flipped[value] = [key] | |
else: |
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 requests | |
import bs4 | |
import json | |
def grabSite(url): | |
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.113 Chrome/60.0.3112.113 Safari/537.36'} | |
return requests.get(url, headers=headers) | |
if __name__ == '__main__': | |
DB = [] |
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 | |
stores = {} | |
with open('Database.csv', 'r') as f: | |
reader = csv.reader(f) | |
your_list = list(reader) | |
for line in your_list: | |
stores[line[0]] = line[1] | |
while True: |
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 re | |
from selenium import webdriver | |
import bs4 | |
def extractCollegeName(title): | |
print title | |
for parts in title.split("-"): | |
if 'university' in str(parts).lower() or 'college' in str(parts).lower() or 'institute' in str(parts).lower(): | |
return parts | |
return title |
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 bs4 | |
import requests | |
import csv | |
import json | |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'} | |
res = requests.get('https://www.theverge.com/2017/12/11/16746230/net-neutrality-fcc-isp-congress-campaign-contribution', headers=headers) | |
page = bs4.BeautifulSoup(res.text, 'lxml') | |
dataBase = [] | |
with open('example.csv', 'rb') as f: | |
reader = csv.reader(f) |