Skip to content

Instantly share code, notes, and snippets.

View KalebNyquist's full-sized avatar

Kaleb Nyquist KalebNyquist

View GitHub Profile
@KalebNyquist
KalebNyquist / step4.py
Created September 16, 2019 16:41
Medium Post Step 4
upload_dict = {
"fields": {
"URL" : article.url,
"Title" : article.title,
"Date" : publish_date(article),
"Author(s)" : article.authors,
"Site Name" : article.meta_data['og']['site_name'],
"Media" : determine_media(article),
"Opinion" : determine_opinion(article),
"Keywords" : article.keywords,
@KalebNyquist
KalebNyquist / step2.py
Created September 16, 2019 16:37
Medium Post Step 2
import newspaper
article = newspaper.Article(urls[0])
article.download()
article.parse()
article.nlp()
@KalebNyquist
KalebNyquist / step1.py
Last active September 16, 2019 16:26
Medium Post
import requests
headers = {"Authorization" : "Bearer [INSERT AIRTABLE API KEY HERE]"}
params = (
('maxRecords', '100'),
('view', 'Grid view'))
URL = 'https://api.airtable.com/v0/appgaUkvDLKnYOmdA/URLS%20to%20Process'
response = requests.get(URL, params = params, headers = headers)
@KalebNyquist
KalebNyquist / strange_zeroes.py
Created September 13, 2019 16:22
Strange Zeroes #EDA
import pandas as pd
import numpy as np
def strange_zeroes(dataset, drop_columns = None, zero = 0):
"""Exploratory Data Analysis function that looks to see if there is any correlation between '0' values occurerence,
which would suggest a relationship between the instruments used and their non-detection of a value."""
# Find all zeroes (can be altered to including other common missing / non-response values as well)
zeroes = (dataset == zero)