Skip to content

Instantly share code, notes, and snippets.

View kstohr's full-sized avatar

Kate Stohr kstohr

View GitHub Profile
@kstohr
kstohr / useful_pandas_snippets.py
Created February 2, 2016 21:03 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@kstohr
kstohr / facebook-search
Created March 8, 2016 17:46 — forked from jamiembrown/facebook-search
Get access token and search Facebook graph search using Python
@kstohr
kstohr / FacebookGroupLikesCounter.py
Created March 8, 2016 17:50 — forked from ZacSweers/FacebookGroupLikesCounter.py
Python code for getting like stats from posts in a Facebook group
from Queue import Queue # Threadsafe queue for threads to use
from collections import Counter # To count stuff for us
import datetime # Because datetime printing is hard
from pprint import pprint
import time # Should be obvious
import subprocess # Used to send notifications on mac
import sys # Get system info
import threading # Should be obvious
import json # Also obvious
@kstohr
kstohr / base.css
Created April 24, 2016 00:27 — forked from planetoftheweb/base.css
Base CSS document with google fonts, Eric Meyer's reset.css, Ethan Schoonover's solarized palette and some basic responsive code.
@import url(http://fonts.googleapis.com/css?family=Roboto+Slab:700|Exo+2:300,600);
/* Eric Meyer's Reset CSS v2.0 - http://cssreset.com */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
/* Solarized Palette - http://ethanschoonover.com/solarized ---------
lightgray : #819090;
gray : #70
@kstohr
kstohr / analytic_wfm.py
Created April 25, 2016 17:16 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@kstohr
kstohr / README.md
Created May 8, 2016 23:55 — forked from mmattozzi/README.md
Bubble Chart

Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

@kstohr
kstohr / Procfile
Created March 6, 2017 18:12 — forked from woeldiche/Procfile
Share your Framer.js prototypes
web: NODE_ENV=production node server.js
@kstohr
kstohr / fb_group_page_query.py
Last active December 20, 2021 18:33
Facebook Graph API: Search for pages and groups that match a query list
import os
import traceback
import logging
import facebook
import requests
import pandas as pd
import json
import time
import numpy as np
from pandas.io.json import json_normalize
@kstohr
kstohr / plotly_example.py
Last active April 13, 2017 05:00
How to uses plot.ly to plot inline and save files to imbed on web pages
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.graph_objs import *
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
import plotly.tools as tls
@kstohr
kstohr / slackbot_example.py
Created April 13, 2017 22:05
Python Slackbot for sending data to Slack
from slackclient import SlackClient
import json
import requests
# Store your data output/analysis as a variable named 'attachment'
# See: https://api.slack.com/docs/messages
attachment = {"text": "And, here is an attachment"}
# Output to json, if in other format