Skip to content

Instantly share code, notes, and snippets.

View jbarton311's full-sized avatar

Jay Bee jbarton311

View GitHub Profile
@jbarton311
jbarton311 / billionaire_matplotlib.py
Created November 13, 2019 03:24
How to draw a simple plot in matplotlib
from matplotlib import pyplot as plt
plt.style.use("fivethirtyeight")
COLORS = ['#456789', '#894567', '#678945', '#3B3D4B', '#FF8181']
# Create data
x4 = ['$50K (Median Salary)', '$1 Million', '$1 Billion']
y4 = [50000, 1000000, 1000000000]
# Create a figure and axis
@jbarton311
jbarton311 / world_golf_rankings.py
Created April 6, 2019 19:26
pull golf world rankings
import pandas as pd
# Started by Googling "World Golf Rankings"
# Clicked on 1st site I found
# Needed to expand the ranking table to "all"
data = pd.read_html('http://www.owgr.com/ranking?pageNo=1&pageSize=All&country=All')
# pd.read_html will return a list of data frames
# usually you need to go through this list to find the data
# you are looking for
@jbarton311
jbarton311 / genius_api_helper.py
Created March 2, 2019 15:43
Works on top of a spotify script (gets current song) and is used to pull lyrics for current playing song from Genius (API & Web Scrape)
import requests
import os
from bs4 import BeautifulSoup
# The below gist is where this file lives
#https://gist.github.com/jbarton311/df1f5e876ff97eb848a41edcbdcb5e6c
import spotify_pulls as sp
# Local file that contains API keys and secrets
from config import Config
@jbarton311
jbarton311 / spotify_api_helper.py
Created March 2, 2019 15:39
Script to call spotify API. Functions for current track and top historical artists & songs.
import requests
import os
import logging
# Local file that contains API keys and secrets
from config import Config
# create logger
logger = logging.getLogger(__file__)
logger.setLevel(logging.DEBUG)