As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
from collections import namedtuple | |
def convert(dictionary): | |
return namedtuple('GenericDict', dictionary.keys())(**dictionary) | |
""" | |
>>> d = dictionary(a=1, b='b', c=[3]) | |
>>> named = convert(d) | |
>>> named.a == d.a | |
True | |
>>> named.b == d.b |
#https://stackoverflow.com/questions/31845258/pandas-multi-index-plotting | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from itertools import groupby | |
import numpy as np | |
%matplotlib inline | |
groups = ('Group 1', 'Group 2') | |
sexes = ('Male', 'Female') |
fig, ax = plt.subplots(len(set(df_all.structure))-1,len(df_all.columns)-1,figsize=(30.0, 30.0), sharey=False) #, tight_layout=True, sharex=True, | |
for j, struc in enumerate(set(df_all.structure)): #19 structures | |
df_onestruc=df_all[df_all.structure==struc] | |
df_onestruc.index=df_onestruc['index'] | |
df_onestruc=df_onestruc.drop(['structure', 'index'], axis=1) | |
for i, col in enumerate(df_onestruc.columns): # 18 parameters | |
ax[i,j].plot(df_onestruc[col]) | |
ax[i,j].grid(True) | |
ax[i,j].get_yaxis().set_ticks([]) #.set_visible(False) |
I have been testing various ways to read and write text files with GZIP in Python. There were a lot of uninteresting results, but there were two I thought were worth sharing.
If you have a big list of strings to write to a file, you might be tempted to do:
f = gzip.open(out_path, 'wb')
for line in lines: