1. 程式人生 > >常用numpy的函式彙總

常用numpy的函式彙總

np.ones(shapem dtype=None, order='C')
//return a new array of given shape and type

e.g:

numpy.eye(N,M=None, k=0, dtype=<class 'float'>, order='C')
//return a 2-D array with ones on the diagonal and zeros else where

e.g

np.zeros(shape, dtype=float, order='C')
//return a new array of given shape and type, filled with zeros

e.g

np.random.randint(low, high=None, size=None, dtype='l')
//return random integers from low(inclusive) to high(exclusive)

e.g

np.mod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', \
dtype=None, subok=True[, signature, extobj]) = <ufunc 'remainder'>
//return element-wise remainder of division

e.g