I am Charmie

メモとログ

2015-07-12から1日間の記事一覧

Python: update a script .py file after edit

[code lang="python"] import hoge edit the hoge.py reload(hoge) [/code] You might have an experience that iPython/Anaconda seems to ignore your update on a script file. No matter how many times you edited and saved, iPython/Anaconda returns…

Python: load a list of file names in a directory

There are two functions, os.listdir and glob.glob, for the purpose. os.listdir loads all the filenames in the specified directory. [code lang="python"] import os filelist = os.listdir('dirName/') [/code] glob.glob loads all the filenames i…

Python: mean of a matrix along a specified axis

[code lang="python"] import numpy generate a 10x3 matrix with random values M = numpy.random.random*1 mean along row resulting a 3x1 vector meanRow = M.mean(axis=0) mean along column resulting a 10x1 vector meanCol = M.mean(axis=1) [/code]…