Skip to content

Instantly share code, notes, and snippets.

View ebunt's full-sized avatar
๐Ÿ•โ€๐Ÿฆบ
๐Ÿป ๐Ÿฅพ ๐ŸŒฏ ๐ŸŒฎ ๐Ÿ“š ๐Ÿƒ๐Ÿผ ๐Ÿœ ๐Ÿฅ—

Edward Bunt ebunt

๐Ÿ•โ€๐Ÿฆบ
๐Ÿป ๐Ÿฅพ ๐ŸŒฏ ๐ŸŒฎ ๐Ÿ“š ๐Ÿƒ๐Ÿผ ๐Ÿœ ๐Ÿฅ—
View GitHub Profile
@ebunt
ebunt / df_flexi_query.py
Created February 13, 2024 16:49 — forked from asehmi/df_flexi_query.py
Flexible data filtering UI with declarative query builder [Streamlit, Pandas]
import streamlit as st
import pandas as pd
st.header('Flexible Data Filtering UI')
data = [
{
'name':'name1',
'nickname':'nickname1',
'date':2010,

nflfastR Python Guide

August 2021: This serves as the first refresh of this guide. My hope is that this guide is a constant work in progress, receiving updates as I receive requests and discover new things myself. This update features more data visualization examples and a more detailed filtering section. I've also posted all relevant code in the guide to github in a Jupyter Notebook, found here.

This guide serves as an update to my original nflscrapR Python Guide. As of 2020, nflscrapR is defunct and nflfastR has taken its place. As the name implies, the library has made the process of scraping new play by play data much faster.

Using Jupyter Notebooks or Jupyter Lab, which come pre-installed with Anaconda is typically the best way to work with

@ebunt
ebunt / iam-policy.json
Created April 12, 2023 02:25 — forked from quiver/iam-policy.json
How to connect to Amazon RDS PostgreSQL with IAM credentials
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:region:account-id:dbuser:dbi-resource-id/database-user-name"
@ebunt
ebunt / ogd-in-sql.ipynb
Created March 14, 2023 20:07 — forked from MaxHalford/ogd-in-sql.ipynb
Online gradient descent written in SQL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ebunt
ebunt / list_synapse_files_recursively.py
Created June 16, 2022 03:45 — forked from mdrakiburrahman/list_synapse_files_recursively.py
Recursively listing Data Lake files with `display` implemented
def deep_ls(path: str, max_depth=1):
"""
List all files and folders in specified path and
subfolders within maximum recursion depth.
"""
# List all files in path and apply sorting rules
li = mssparkutils.fs.ls(path)
# Return all files
@ebunt
ebunt / list_synapse_files_recursively.py
Created June 16, 2022 03:45 — forked from mdrakiburrahman/list_synapse_files_recursively.py
Recursively listing Data Lake files with `display` implemented
def deep_ls(path: str, max_depth=1):
"""
List all files and folders in specified path and
subfolders within maximum recursion depth.
"""
# List all files in path and apply sorting rules
li = mssparkutils.fs.ls(path)
# Return all files
@ebunt
ebunt / csv2xml.py
Created August 8, 2021 15:40 — forked from justinvw/csv2xml.py
Simple script to convert a CSV file to XML
#!/usr/bin/env python
# encoding: utf-8
"""
csv2xml.py
Created by Justin van Wees on 2011-04-18.
"""
import sys
import os
import string
@ebunt
ebunt / boto3-gzip.py
Created May 18, 2021 14:56 — forked from tobywf/boto3-gzip.py
GZIP compressing files for S3 uploads with boto3
from io import BytesIO
import gzip
import shutil
def upload_gzipped(bucket, key, fp, compressed_fp=None, content_type='text/plain'):
"""Compress and upload the contents from fp to S3.
If compressed_fp is None, the compression is performed in memory.
"""
@ebunt
ebunt / postgres_queries_and_commands.sql
Created February 1, 2021 16:34 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ebunt
ebunt / LearnGoIn5mins.md
Created January 22, 2021 15:10 — forked from prologic/LearnGoIn5mins.md
Learn Go in ~5mins