**Memos on Python Scientific Computing**
Nov 20, 2017
Back to
Home >
Categories > others
A cheating sheet on Scipy, etc.
$ ipython qtconsole –pylab=inline # old feature
$ ipython –pylab
requires matplotlib
and PyQt
for inline ploting
Ctrl + P
forward matchingCtrl + P
backward matchingCtrl + P
readline_iX
: input in line X_X
: output in line X %debug
u/d
%pdb iX (X is variable)
dtype: variabel type
astype(np.newtype)
changing the type to newtype
chaning of slice of an array will be broadcast
for copying, using array[:].copy()
index and slice, array[:,:,:]
x[1,2,…] is equivalent to x[1,2,:,:,:], x[…,3] to x[:,:,:,:,3] and x[4,…,5,:] to x[4,:,:,5,:]
array ==/!=/ value giving a boolean list with the same length, here the express array |/& value
is used as boolean index.
array(boolean_list) selecting the true element and broadcasting.
data[data<0] = 0
# changing the negative elements to 0s
a([i:],[j:],[]…)
.T
b = np.fromfunction(f,(5,4),dtype=int)
TBD
------------------------------------------ **Tags**