To create an anchor to a heading in github flavored markdown.
Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:
[create an anchor](#anchors-in-markdown)
| # 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(valuelist)] |
| ''' | |
| Save this file and add the following line to your ~/.bashrc" | |
| export PYTHONSTARTUP="$HOME/.pythonrc" | |
| ''' | |
| import os | |
| import readline | |
| import rlcompleter | |
| import atexit |
| """ | |
| Convert Pandas DFs in an HDFStore to parquet files for better compatibility | |
| with Spark. | |
| Run from the command line with: | |
| spark-submit --driver-memory 4g --master 'local[*]' hdf5_to_parquet.py | |
| """ | |
| import pandas as pd |
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| # This little project is hosted at: <https://gist.github.com/1455741> | |
| # Copyright 2011-2012 Álvaro Justen [alvarojusten at gmail dot com] | |
| # License: GPL <http://www.gnu.org/copyleft/gpl.html> | |
| import os | |
| from email.mime.multipart import MIMEMultipart | |
| from email.mime.text import MIMEText |
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| # You need PIL <http://www.pythonware.com/products/pil/> to run this script | |
| # Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use | |
| # any TTF you have) | |
| # Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com] | |
| # License: GPL <http://www.gnu.org/copyleft/gpl.html> | |
| from image_utils import ImageText |
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb
| #!/usr/bin/env python | |
| ''' | |
| Send an multipart email with HTML and plain text alternatives. The message | |
| should be constructed as a plain-text file of the following format: | |
| From: Your Name <your@email.com> | |
| To: Recipient One <recipient@to.com> | |
| Subject: Your subject line | |
| --- |
| import sqlite3 | |
| import os | |
| import argparse | |
| try: | |
| import pyspark | |
| import pyspark.sql | |
| except ImportError: | |
| import sys | |
| import os |