February 2017
Intermediate to advanced
290 pages
5h 48m
English
To get function documentation, use .__doc__, e.g. print(range.__doc__), or help, e.g. help(zeros) or help(’def’), or ?, e.g. range.count?
def: introduces a function definitionif, else, elif: an if statement consists of a Boolean expression followed by one or more statementsfor: executes a sequence of statements multiple timeswhile: repeats a statement or group of statements while a given condition is true1j or complex: returns complex value, e.g. a=1.3+1j*0.2 or a=complex(1.3,0.2)Methods:
A=array([0,4,12,3]), then type A. and tab, it follows a lot of methods, e.g. the argument of the maximum using A.argmax. For help type, e.g. A.dot?.Functions:
int: converts a number or string to an integerlen: returns the number of items in a containerrange: returns an object that produces a sequence of integerstype: returns the object typeFrom numpy:
abs: returns the absolute value of the argumentarange: returns evenly spaced values within a given intervalargwhere: finds the indices of array elements that are non-zero, grouped by elementarray: creates an arraycos, sin, tan: respectively calculate the cosine, the sine and the tangentcosh: calculates the hyperbolic cosinecumsum: calculates the cumulative sum of array elementsdiff: calculates the n-th discrete difference along a given axisdot: product of two arraysexp, log: respectively calculate the exponential, the logarithmfft: calculates the ...Read now
Unlock full access