Random useful code snippets

Random stuff that I found on the net that looks to be useful.

# when computing multiple moving averages:
#for i in range(2, 10):
#    df['MA{}'.format(i)] = df.rolling(window=i).mean()

# aggreagate average of all MAs, but you can modify this easily to do other stuff    
#df[[f for f in list(df) if "MA" in f]].mean(axis=1)