This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
import numpy | |
# Array of 4 columns and 100 rows | |
data = numpy.random.rand(100, 4) | |
# Create a sample database | |
conn = sqlite3.connect('/tmp/sample.db') | |
cursor = conn.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Capture the output of a process | |
import shlex | |
import subprocess | |
cmdline = 'date --help' | |
p = subprocess.Popen(shlex.split(cmdline), stdout=subprocess.PIPE) | |
print(p.stdout.read()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
from matplotlib.pylab import * | |
import matplotlib.dates as mdates | |
data = loadtxt('quotes.csv', delimiter=',') | |
# Epoch time to number (matlab and matplotlib format) | |
TIMEZONE_CORRECTION = 60.0 * 60 * 5 | |
time = mdates.epoch2num(data[:, 0] / 1000.0 - TIMEZONE_CORRECTION) | |
bid = data[:, 1] |