The shortest connect:
from psycopg2 import connect
psql_conn = connect("dbname=XXX user=XXX password=XXX host=localhost sslmode=require")
psql_conn.close()
| CUDA_LAUNCH_BLOCKING=1 | |
| CUDA_VISIBLE_DEVICES=0,1,2,3 |
| """Do not let the zen slip through your fingers.""" | |
| import this | |
| zen = "".join([this.d[x] if x.isalnum() else x for x in this.s]) |
| import pandas as pd | |
| import pandas.io.sql as pdsql | |
| import psycopg2 | |
| # Database connection details | |
| creds = { | |
| "dbname": "mydb", | |
| "user": "jsmith", | |
| "password": "hello1234", |
| word_df.to_csv("words.tsv", sep="\t", header=False, index=False, quoting=csv.QUOTE_NONE, quotechar="", escapechar="\\") | |
| vec_df.to_csv("vectors.tsv", sep="\t", header=False, index=False, quoting=csv.QUOTE_NONE, quotechar="", escapechar="\\") |
| saved_model_cli show --dir /path/to/saved/model/1521687978/ --all |
| #!/bin/bash | |
| # | |
| # Adds a jupyter kernel for a virtualenv | |
| # This makes the virtualenv available for use in a Jupyter notebook | |
| # Run this from the directory containing your virtualenv directory and | |
| # pass it the directory name for your virtualenv. | |
| # | |
| # Usage: | |
| # $ ./add_jupyter_kernel.sh myvenv | |
| # |
| export PS1="\[\e[1;34m\]\W\[\e[m\] \\$ " |
| # Summary statistics for numeric variables | |
| df.describe().transpose() | |
| # Summary statistics for categorical/string variables | |
| df.describe(include=['O']).transpose() | |
| # Info about column names, datatypes, and null values | |
| df.info() | |
| # Get a sample |
| import matplotlib.pyplot as plt | |
| plt.rcParams["figure.figsize"] = (20,10) |