One fun thing about using the IPython Notebook as my lab book for all my research is that I can do “me”-search in my copious spare time, for example to see the top 25 `numpy` calls I’ve used this year:
In [1]: import glob In [2]: lines = '' for fname in glob.glob('*.py'): with file(fname) as f: lines += f.read() lines += '\n' In [3]: import re # Find top np.* calls In [9]: np_calls = re.findall('np\.[\w\.]+', lines) np_calls[:5] Out[9]: ['np.linspace', 'np.random.random', 'np.random.normal', 'np.sqrt', 'np.random.normal'] In [10]: import pandas as pd In [12]: pd.Series(np_calls).value_counts().head(20) Out[12]: np.array 219 np.random.normal 170 np.mean 130 np.random.seed 126 np.round 124 np.log 119 np.exp 114 np.linspace 96 np.random.choice 84 np.where 84 np.zeros 78 np.ones 65 np.dot 62 np.empty 62 np.sum 52 np.absolute 49 np.nan 47 np.arange 45 np.inf 38 np.sqrt 37
Number one thing: `np.array`! I wonder why I use that.