Skip to content

Instantly share code, notes, and snippets.

@seanickle
seanickle / plots.md
Last active October 1, 2018 22:45
jupyter notebook quick plots

scatter plot

  • Plot x vs y , w/ color based on the hue.
%matplotlib inline

import seaborn as sns
import pandas as pd

# Quick scatter plot
df = pd.read_csv(filename)
@seanickle
seanickle / remote-pdb.debug.md
Last active June 24, 2017 19:17
nice python debug techniques
@seanickle
seanickle / groupby and reset_index.md
Last active February 28, 2019 17:57
useful pandas manip

nice pattern for counting after a groupby without dealing with the MultiIndex .

  • First apply the x if not pd.isnull(x) else 'NaN' mapping function concept to columns which have np.nan in them.
  • (that might not be necessary in pandas 0.17.1 not sure yet. )
  • This feels like a really obvious function combo now in retrospect.
Out[194]: (16037, 21)
  • After writing custom ways to do it finally came across the df[cols].groupby(by=colx).size().reset_index() combo …
@seanickle
seanickle / awesome tools .md
Last active June 24, 2017 19:19
awesome tools

similar to ipdb, pdb

from celery.contrib import rdb
rdb.set_trace()

a

netstat -plant|grep LIST 
def get_all_issue_events(issue_id):
    url = 'https://app.getsentry.com/api/0/issues/%s/events/' % issue_id
    all_data = get_all_data(url)
    return all_data


def get_all_data(url):
get_tag_migrations () {
last_n=$1
migrations_directory=$2
tags=($(git tag --sort version:refname | egrep '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'))
begin=`expr ${#tags[@]} - ${last_n}`
subset_tags=(${tags[@]:${begin}})
for (( i=0; i< `expr ${#subset_tags[@]} - 1` ; i+=1 )) ; # forwards
do