Skip to content

Instantly share code, notes, and snippets.

@jiffyclub
jiffyclub / long_string.ipynb
Created April 15, 2014 18:11
Example of splitting a long string over multiple lines (in an IPython Notebook). http://nbviewer.ipython.org/gist/jiffyclub/10754538
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / assert_frames_equal.ipynb
Last active October 27, 2020 17:02
Example of a function to compare two DataFrames independent of row/column ordering and with handling of null values.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / tserv
Last active September 3, 2020 09:14
Start a Tornado static file server in a given directory. To start the server in the current directory: `tserv .`. Then go to `http://localhost:8000` to browse the directory.
#!/usr/bin/env python
"""
Starts a Tornado static file server in a given directory.
To start the server in the current directory:
tserv .
Then go to http://localhost:8000 to browse the directory.
Use the --prefix option to add a prefix to the served URL,
@jiffyclub
jiffyclub / pygments_magic.py
Created April 15, 2013 03:27
Ipython magics for displaying source code files with syntax highlighting.
"""
IPython magics for displaying source code files with syntax highlighting.
This uses the Pygments library: http://pygments.org.
Two magics are available:
%highlight: This uses a terminal formatter and will work in any of IPython's
front ends.
%highlight_html: This uses an HTML formatter and is best used in the
@jiffyclub
jiffyclub / mpl_sheets_pandas.ipynb
Created November 11, 2014 18:26
Matplotlib stylesheets + Pandas plots
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / .gitconfig
Last active October 7, 2019 21:06
My git aliases
[core]
editor = code -nw
[alias]
st = status
ls = log --oneline --decorate
lg = log --oneline --decorate --graph
ff = merge --ff-only
mrg = merge --no-ff
ffpull = pull --ff-only
co = checkout
@jiffyclub
jiffyclub / Excel to Pandas.ipynb
Created July 15, 2017 05:08
Using pandas and xlrd to concatenate multiple excel sheets into a single dataframe. In answer to this Stack Overflow question: https://stackoverflow.com/questions/45113070/how-do-i-make-this-function-for-concatenating-excel-sheets-from-a-single-file-mo#
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / ProfileDemo.ipynb
Created July 6, 2012 19:57
Examples of timing and profiling Python code using built-in tools and IPython. Requires IPython 0.13+.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / sorted_groupby.ipynb
Last active December 22, 2017 23:38
Example of making a groupby generator for a pandas DataFrame when the groupby column is sorted.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / onpypi
Last active November 14, 2017 06:20
Script for checking whether a name is taken on PyPI.
#!/usr/bin/env python
"""
This script checks whether a name is taken on PyPI.
Usage:
onpypi fakename requests
Prints: