%matplotlib inline import numpy as np from matplotlib import pyplot as plt def analyze(filename): data = np.loadtxt(fname=filename, delimiter=',') plt.figure(figsize=(10.0, 3.0)) plt.subplot(1, 3, 1) plt.ylabel('average') plt.plot(data.mean(0)) plt.subplot(1, 3, 2) plt.ylabel('max') plt.plot(data.max(0)) plt.subplot(1, 3, 3) plt.ylabel('min') plt.plot(data.min(0)) plt.tight_layout() plt.show() analyze('inflammation-01.csv') analyze('inflammation-02.csv') def print_characters(element): print element[0] print element[1] print element[2] print element[3] print_characters('lead') print_characters('tin') def print_characters(element): for char in element: print char print_characters('lead') print_characters('oxygen') length = 0 for vowel in 'aeiou': length = length + 1 print 'There are', length, 'vowels' letter = 'z' for letter in 'abc': print letter print 'after the loop, letter is', letter print len('aeiou') odds = [1, 3, 5, 7] print 'odds are:', odds print 'first and last:', odds[0], odds[-1] for number in odds: print number names = ['Newton', 'Darwing', 'Turing'] # typo in Darwin's name print 'names is originally:', names names[1] = 'Darwin' # correct the name print 'final value of names:', names name = 'Bell' name[0] = 'b' odds.append(11) print 'odds after adding a value:', odds del odds[0] print 'odds after removing the first element:', odds odds.reverse() print 'odds after reversing:', odds import glob print glob.glob('*.ipynb') print glob.glob('*.csv') filenames = glob.glob('*.csv') filenames = filenames[0:3] for f in filenames: print f analyze(f)