This file contains 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
# By Jake VanderPlas | |
# License: BSD-style | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def discrete_cmap(N, base_cmap=None): | |
"""Create an N-bin discrete colormap from the specified input map""" |
This file contains 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 psycopg2 | |
from psycopg2.extensions import ISOLATION_LEVEL_SERIALIZABLE | |
conn_str = "dbname='{db}' user='john' host='localhost' password='john'" | |
table_sql = "CREATE TABLE bigdata (A INT PRIMARY KEY, b TEXT, c TEXT NOT NULL);" | |
conn1 = psycopg2.connect(conn_str.format(db='test-1')) | |
conn2 = psycopg2.connect(conn_str.format(db='test-2')) |