Skip to content

Instantly share code, notes, and snippets.

View notebook_startup.py
import numpy as np
import pandas as pd
import itertools as it
import matplotlib.pyplot as plt
import logging
log_fmt = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(level=logging.INFO, format=log_fmt)
logging.info('BEGIN')
@gpfreitas
gpfreitas / pytest.md
Created Jun 3, 2018 — forked from kwmiebach/pytest.md
pytest cheat sheet
View pytest.md

Usage

(Remember to create a symlink pytest for py.test)

pytest [options] [file_or_dir] [file_or_dir] ...

Help:

View parse_import_dis.py
"""
This script takes as input a list of Python source files and outputs the
top-level modules that are imported in those source files.
The script does this without executing any code. This is useful when you have
exercise code (that often has syntax errors / missing code) or if you want to
avoid any harmful side-effects of executing untrusted code.
"""
@gpfreitas
gpfreitas / unix_ref.rst
Created Nov 28, 2015
Resources for someone who wants to learn to use UNIX-like systems from the command-line, with some focus on data analysis
View unix_ref.rst
@gpfreitas
gpfreitas / hist.awk
Last active Nov 24, 2015
Histogram for integer x and y values
View hist.awk
# hist.awk - Histogram for integer x and y values
#
# This AWK program takes as input a sequence of x, y integer values, one per
# row, where x is supposed to be the bin, and y is the count of values in that
# bin. In other words, this sequence already encodes the histogram (think of
# the output of uniq -c), so this script only pretty prints that histogram to
# the screen. Furthermore, we assume that the input rows are sorted by the bin
# values (the first column) and that the counts in the second column are always
# nonnegative.
#
@gpfreitas
gpfreitas / pig_nan_null_inf.sh
Last active Aug 29, 2015
Test operations with NULL, NaN and Infinity in Pig
View pig_nan_null_inf.sh
#!/usr/bin/env sh
USAGE='NAME
pig_nan_null_inf.sh -- Test operations with NULL, NaN and Infinity
SYNOPSIS
./pig_nan_null_inf.sh
DESCRIPTION