1. NumPy¶
- Provides
- An array object of arbitrary homogeneous items
- Fast mathematical operations over arrays
- Linear Algebra, Fourier Transforms, Random Number Generation
1.1. How to use the documentation¶
Documentation is available in two forms: docstrings provided with the code, and a loose standing reference guide, available from the NumPy homepage.
We recommend exploring the docstrings using IPython, an advanced Python shell with TAB-completion and introspection capabilities. See below for further instructions.
The docstring examples assume that numpy has been imported as np:
>>> import numpy as np
Code snippets are indicated by three greater-than signs:
>>> x = 42
>>> x = x + 1
Use the built-in help function to view a function’s docstring:
>>> help(np.sort)
...
For some objects, np.info(obj) may provide additional help. This is
particularly true if you see the line “Help on ufunc object:” at the top
of the help() page. Ufuncs are implemented in C, not Python, for speed.
The native Python help() does not know how to view their help, but our
np.info() function does.
To search for documents containing a keyword, do:
>>> np.lookfor('keyword')
...
General-purpose documents like a glossary and help on the basic concepts
of numpy are available under the doc sub-module:
>>> from numpy import doc
>>> help(doc)
...
1.2. Available subpackages¶
- doc
- Topical documentation on broadcasting, indexing, etc.
- lib
- Basic functions used by several sub-packages.
- random
- Core Random Tools
- linalg
- Core Linear Algebra Tools
- fft
- Core FFT routines
- polynomial
- Polynomial tools
- testing
- Numpy testing tools
- f2py
- Fortran to Python Interface Generator.
- distutils
- Enhancements to distutils with support for Fortran compilers support and more.
1.3. Utilities¶
- test
- Run numpy unittests
- show_config
- Show numpy build configuration
- dual
- Overwrite certain functions with high-performance Scipy tools
- matlib
- Make everything matrices.
- __version__
- Numpy version string
1.4. Viewing documentation using IPython¶
Start IPython with the NumPy profile (ipython -p numpy), which will
import numpy under the alias np. Then, use the cpaste command to
paste examples into the shell. To see which functions are available in
numpy, type np.<TAB> (where <TAB> refers to the TAB key), or use
np.*cos*?<ENTER> (where <ENTER> refers to the ENTER key) to narrow
down the list. To view the docstring for a function, use
np.cos?<ENTER> (to view the docstring) and np.cos??<ENTER> (to view
the source code).
1.5. Copies vs. in-place operation¶
Most of the functions in numpy return a copy of the array argument
(e.g., np.sort). In-place versions of these functions are often
available as array methods, i.e. x = np.array([1,2,3]); x.sort().
Exceptions to this rule are documented.
1.6. Functions¶
add_docstring(obj, docstring) |
Add a docstring to a built-in obj if possible. |
add_newdoc(place, obj, doc) |
Adds documentation to obj which is in module place. |
add_newdoc_ufunc(ufunc, new_docstring) |
Replace the docstring for a ufunc with new_docstring. |
alen(a) |
Return the length of the first dimension of the input array. |
all(a[, axis, out, keepdims]) |
Test whether all array elements along a given axis evaluate to True. |
allclose(a, b[, rtol, atol, equal_nan]) |
Returns True if two arrays are element-wise equal within a tolerance. |
alltrue(a[, axis, out, keepdims]) |
Check if all elements of input array are true. |
alterdot() |
Change dot, vdot, and inner to use accelerated BLAS functions. |
amax(a[, axis, out, keepdims]) |
Return the maximum of an array or maximum along an axis. |
amin(a[, axis, out, keepdims]) |
Return the minimum of an array or minimum along an axis. |
angle(z[, deg]) |
Return the angle of the complex argument. |
any(a[, axis, out, keepdims]) |
Test whether any array element along a given axis evaluates to True. |
append(arr, values[, axis]) |
Append values to the end of an array. |
apply_along_axis(func1d, axis, arr, *args, ...) |
Apply a function to 1-D slices along the given axis. |
apply_over_axes(func, a, axes) |
Apply a function repeatedly over multiple axes. |
arange([start,] stop[, step,][, dtype]) |
Return evenly spaced values within a given interval. |
argmax(a[, axis, out]) |
Returns the indices of the maximum values along an axis. |
argmin(a[, axis, out]) |
Returns the indices of the minimum values along an axis. |
argpartition(a, kth[, axis, kind, order]) |
Perform an indirect partition along the given axis using the algorithm specified by the kind keyword. |
argsort(a[, axis, kind, order]) |
Returns the indices that would sort an array. |
argwhere(a) |
Find the indices of array elements that are non-zero, grouped by element. |
around(a[, decimals, out]) |
Evenly round to the given number of decimals. |
array(object[, dtype, copy, order, subok, ndmin]) |
Create an array. |
array2string(a[, max_line_width, precision, ...]) |
Return a string representation of an array. |
array_equal(a1, a2) |
True if two arrays have the same shape and elements, False otherwise. |
array_equiv(a1, a2) |
Returns True if input arrays are shape consistent and all elements equal. |
array_repr(arr[, max_line_width, precision, ...]) |
Return the string representation of an array. |
array_split(ary, indices_or_sections[, axis]) |
Split an array into multiple sub-arrays. |
array_str(a[, max_line_width, precision, ...]) |
Return a string representation of the data in an array. |
asanyarray(a[, dtype, order]) |
Convert the input to an ndarray, but pass ndarray subclasses through. |
asarray(a[, dtype, order]) |
Convert the input to an array. |
asarray_chkfinite(a[, dtype, order]) |
Convert the input to an array, checking for NaNs or Infs. |
ascontiguousarray(a[, dtype]) |
Return a contiguous array in memory (C order). |
asfarray(a[, dtype]) |
Return an array converted to a float type. |
asfortranarray(a[, dtype]) |
Return an array laid out in Fortran order in memory. |
asmatrix(data[, dtype]) |
Interpret the input as a matrix. |
asscalar(a) |
Convert an array of size 1 to its scalar equivalent. |
atleast_1d(*arys) |
Convert inputs to arrays with at least one dimension. |
atleast_2d(*arys) |
View inputs as arrays with at least two dimensions. |
atleast_3d(*arys) |
View inputs as arrays with at least three dimensions. |
average(a[, axis, weights, returned]) |
Compute the weighted average along the specified axis. |
bartlett(M) |
Return the Bartlett window. |
base_repr(number[, base, padding]) |
Return a string representation of a number in the given base system. |
binary_repr(num[, width]) |
Return the binary representation of the input number as a string. |
bincount(x[, weights, minlength]) |
Count number of occurrences of each value in array of non-negative ints. |
blackman(M) |
Return the Blackman window. |
bmat(obj[, ldict, gdict]) |
Build a matrix object from a string, nested sequence, or array. |
broadcast_arrays(*args, **kwargs) |
Broadcast any number of arrays against each other. |
broadcast_to(array, shape[, subok]) |
Broadcast an array to a new shape. |
busday_count(begindates, enddates[, ...]) |
Counts the number of valid days between begindates and enddates, not including the day of enddates. |
busday_offset(dates, offsets[, roll, ...]) |
First adjusts the date to fall on a valid day according to the roll rule, then applies offsets to the given dates counted in valid days. |
byte_bounds(a) |
Returns pointers to the end-points of an array. |
can_cast(from, totype, casting = ) |
Returns True if cast between data types can occur according to the casting rule. |
choose(a, choices[, out, mode]) |
Construct an array from an index array and a set of arrays to choose from. |
clip(a, a_min, a_max[, out]) |
Clip (limit) the values in an array. |
column_stack(tup) |
Stack 1-D arrays as columns into a 2-D array. |
common_type(*arrays) |
Return a scalar type which is common to the input arrays. |
compare_chararrays |
|
compress(condition, a[, axis, out]) |
Return selected slices of an array along given axis. |
concatenate((a1, a2, ...)[, axis]) |
Join a sequence of arrays along an existing axis. |
convolve(a, v[, mode]) |
Returns the discrete, linear convolution of two one-dimensional sequences. |
copy(a[, order]) |
Return an array copy of the given object. |
copyto(dst, src[, casting, where]) |
Copies values from one array to another, broadcasting as necessary. |
corrcoef(x[, y, rowvar, bias, ddof]) |
Return Pearson product-moment correlation coefficients. |
correlate(a, v[, mode]) |
Cross-correlation of two 1-dimensional sequences. |
count_nonzero(a) |
Counts the number of non-zero values in the array a. |
cov(m[, y, rowvar, bias, ddof, fweights, ...]) |
Estimate a covariance matrix, given data and weights. |
cross(a, b[, axisa, axisb, axisc, axis]) |
Return the cross product of two (arrays of) vectors. |
cumprod(a[, axis, dtype, out]) |
Return the cumulative product of elements along a given axis. |
cumproduct(a[, axis, dtype, out]) |
Return the cumulative product over the given axis. |
cumsum(a[, axis, dtype, out]) |
Return the cumulative sum of the elements along a given axis. |
datetime_as_string |
|
datetime_data |
|
delete(arr, obj[, axis]) |
Return a new array with sub-arrays along an axis deleted. |
deprecate(*args, **kwargs) |
Issues a DeprecationWarning, adds warning to old_name‘s docstring, rebinds old_name.__name__ and returns the new function object. |
deprecate_with_doc(msg) |
|
diag(v[, k]) |
Extract a diagonal or construct a diagonal array. |
diag_indices(n[, ndim]) |
Return the indices to access the main diagonal of an array. |
diag_indices_from(arr) |
Return the indices to access the main diagonal of an n-dimensional array. |
diagflat(v[, k]) |
Create a two-dimensional array with the flattened input as a diagonal. |
diagonal(a[, offset, axis1, axis2]) |
Return specified diagonals. |
diff(a[, n, axis]) |
Calculate the n-th order discrete difference along given axis. |
digitize(x, bins[, right]) |
Return the indices of the bins to which each value in input array belongs. |
disp(mesg[, device, linefeed]) |
Display a message on a device. |
dot(a, b[, out]) |
Dot product of two arrays. |
dsplit(ary, indices_or_sections) |
Split array into multiple sub-arrays along the 3rd axis (depth). |
dstack(tup) |
Stack arrays in sequence depth wise (along third axis). |
ediff1d(ary[, to_end, to_begin]) |
The differences between consecutive elements of an array. |
einsum(subscripts, *operands[, out, dtype, ...]) |
Evaluates the Einstein summation convention on the operands. |
empty(shape[, dtype, order]) |
Return a new array of given shape and type, without initializing entries. |
empty_like(a[, dtype, order, subok]) |
Return a new array with the same shape and type as a given array. |
expand_dims(a, axis) |
Expand the shape of an array. |
extract(condition, arr) |
Return the elements of an array that satisfy some condition. |
eye(N[, M, k, dtype]) |
Return a 2-D array with ones on the diagonal and zeros elsewhere. |
fastCopyAndTranspose(a) |
|
fill_diagonal(a, val[, wrap]) |
Fill the main diagonal of the given array of any dimensionality. |
find_common_type(array_types, scalar_types) |
Determine common type following standard coercion rules. |
fix(x[, y]) |
Round to nearest integer towards zero. |
flatnonzero(a) |
Return indices that are non-zero in the flattened version of a. |
fliplr(m) |
Flip array in the left/right direction. |
flipud(m) |
Flip array in the up/down direction. |
frombuffer(buffer[, dtype, count, offset]) |
Interpret a buffer as a 1-dimensional array. |
fromfile(file[, dtype, count, sep]) |
Construct an array from data in a text or binary file. |
fromfunction(function, shape, **kwargs) |
Construct an array by executing a function over each coordinate. |
fromiter(iterable, dtype[, count]) |
Create a new 1-dimensional array from an iterable object. |
frompyfunc(func, nin, nout) |
Takes an arbitrary Python function and returns a Numpy ufunc. |
fromregex(file, regexp, dtype) |
Construct an array from a text file, using regular expression parsing. |
fromstring(string[, dtype, count, sep]) |
A new 1-D array initialized from raw binary or text data in a string. |
full(shape, fill_value[, dtype, order]) |
Return a new array of given shape and type, filled with fill_value. |
full_like(a, fill_value[, dtype, order, subok]) |
Return a full array with the same shape and type as a given array. |
fv(rate, nper, pmt, pv[, when]) |
Compute the future value. |
genfromtxt(fname[, dtype, comments, ...]) |
Load data from a text file, with missing values handled as specified. |
get_array_wrap(*args) |
Find the wrapper for the array with the highest priority. |
get_include() |
Return the directory that contains the NumPy *.h header files. |
get_printoptions() |
Return the current print options. |
getbuffer(obj [,offset[, size]]) |
Create a buffer object from the given object referencing a slice of length size starting at offset. |
getbufsize() |
Return the size of the buffer used in ufuncs. |
geterr() |
Get the current way of handling floating-point errors. |
geterrcall() |
Return the current callback function used on floating-point errors. |
geterrobj() |
Return the current object that defines floating-point error handling. |
gradient(f, *varargs, **kwargs) |
Return the gradient of an N-dimensional array. |
hamming(M) |
Return the Hamming window. |
hanning(M) |
Return the Hanning window. |
histogram(a[, bins, range, normed, weights, ...]) |
Compute the histogram of a set of data. |
histogram2d(x, y[, bins, range, normed, weights]) |
Compute the bi-dimensional histogram of two data samples. |
histogramdd(sample[, bins, range, normed, ...]) |
Compute the multidimensional histogram of some data. |
hsplit(ary, indices_or_sections) |
Split an array into multiple sub-arrays horizontally (column-wise). |
hstack(tup) |
Stack arrays in sequence horizontally (column wise). |
i0(x) |
Modified Bessel function of the first kind, order 0. |
identity(n[, dtype]) |
Return the identity array. |
imag(val) |
Return the imaginary part of the elements of the array. |
in1d(ar1, ar2[, assume_unique, invert]) |
Test whether each element of a 1-D array is also present in a second array. |
indices(dimensions[, dtype]) |
Return an array representing the indices of a grid. |
info([object, maxwidth, output, toplevel]) |
Get help information for a function, class, or module. |
inner(a, b) |
Inner product of two arrays. |
insert(arr, obj, values[, axis]) |
Insert values along the given axis before the given indices. |
int_asbuffer |
|
interp(x, xp, fp[, left, right, period]) |
One-dimensional linear interpolation. |
intersect1d(ar1, ar2[, assume_unique]) |
Find the intersection of two arrays. |
ipmt(rate, per, nper, pv[, fv, when]) |
Compute the interest portion of a payment. |
irr(values) |
Return the Internal Rate of Return (IRR). |
is_busday(dates[, weekmask, holidays, ...]) |
Calculates which of the given dates are valid days, and which are not. |
isclose(a, b[, rtol, atol, equal_nan]) |
Returns a boolean array where two arrays are element-wise equal within a tolerance. |
iscomplex(x) |
Returns a bool array, where True if input element is complex. |
iscomplexobj(x) |
Check for a complex type or an array of complex numbers. |
isfortran(a) |
Returns True if the array is Fortran contiguous but not C contiguous. |
isneginf(x[, y]) |
Test element-wise for negative infinity, return result as bool array. |
isposinf(x[, y]) |
Test element-wise for positive infinity, return result as bool array. |
isreal(x) |
Returns a bool array, where True if input element is real. |
isrealobj(x) |
Return True if x is a not complex type or an array of complex numbers. |
isscalar(num) |
Returns True if the type of num is a scalar type. |
issctype(rep) |
Determines whether the given object represents a scalar data-type. |
issubclass_(arg1, arg2) |
Determine if a class is a subclass of a second class. |
issubdtype(arg1, arg2) |
Returns True if first argument is a typecode lower/equal in type hierarchy. |
issubsctype(arg1, arg2) |
Determine if the first argument is a subclass of the second argument. |
iterable(y) |
Check whether or not an object can be iterated over. |
ix_(*args) |
Construct an open mesh from multiple sequences. |
kaiser(M, beta) |
Return the Kaiser window. |
kron(a, b) |
Kronecker product of two arrays. |
lexsort(keys[, axis]) |
Perform an indirect sort using a sequence of keys. |
linspace(start, stop[, num, endpoint, ...]) |
Return evenly spaced numbers over a specified interval. |
load(file[, mmap_mode, allow_pickle, ...]) |
Load arrays or pickled objects from .npy, .npz or pickled files. |
loads |
loads(string) – Load a pickle from the given string |
loadtxt(fname[, dtype, comments, delimiter, ...]) |
Load data from a text file. |
logspace(start, stop[, num, endpoint, base, ...]) |
Return numbers spaced evenly on a log scale. |
lookfor(what[, module, import_modules, ...]) |
Do a keyword search on docstrings. |
mafromtxt(fname, **kwargs) |
Load ASCII data stored in a text file and return a masked array. |
mask_indices(n, mask_func[, k]) |
Return the indices to access (n, n) arrays, given a masking function. |
mat(data[, dtype]) |
Interpret the input as a matrix. |
matmul(a, b[, out]) |
Matrix product of two arrays. |
max(a[, axis, out, keepdims]) |
Return the maximum of an array or maximum along an axis. |
maximum_sctype(t) |
Return the scalar type of highest precision of the same kind as the input. |
may_share_memory |
Determine if two arrays can share memory |
mean(a[, axis, dtype, out, keepdims]) |
Compute the arithmetic mean along the specified axis. |
median(a[, axis, out, overwrite_input, keepdims]) |
Compute the median along the specified axis. |
meshgrid(*xi, **kwargs) |
Return coordinate matrices from coordinate vectors. |
min(a[, axis, out, keepdims]) |
Return the minimum of an array or minimum along an axis. |
min_scalar_type(a) |
For scalar a, returns the data type with the smallest size and smallest scalar kind which can hold its value. |
mintypecode(typechars[, typeset, default]) |
Return the character for the minimum-size type to which given types can be safely cast. |
mirr(values, finance_rate, reinvest_rate) |
Modified internal rate of return. |
msort(a) |
Return a copy of an array sorted along the first axis. |
nan_to_num(x) |
Replace nan with zero and inf with finite numbers. |
nanargmax(a[, axis]) |
Return the indices of the maximum values in the specified axis ignoring NaNs. |
nanargmin(a[, axis]) |
Return the indices of the minimum values in the specified axis ignoring NaNs. |
nanmax(a[, axis, out, keepdims]) |
Return the maximum of an array or maximum along an axis, ignoring any NaNs. |
nanmean(a[, axis, dtype, out, keepdims]) |
Compute the arithmetic mean along the specified axis, ignoring NaNs. |
nanmedian(a[, axis, out, overwrite_input, ...]) |
Compute the median along the specified axis, while ignoring NaNs. |
nanmin(a[, axis, out, keepdims]) |
Return minimum of an array or minimum along an axis, ignoring any NaNs. |
nanpercentile(a, q[, axis, out, ...]) |
Compute the qth percentile of the data along the specified axis, while ignoring nan values. |
nanprod(a[, axis, dtype, out, keepdims]) |
Return the product of array elements over a given axis treating Not a Numbers (NaNs) as zero. |
nanstd(a[, axis, dtype, out, ddof, keepdims]) |
Compute the standard deviation along the specified axis, while ignoring NaNs. |
nansum(a[, axis, dtype, out, keepdims]) |
Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. |
nanvar(a[, axis, dtype, out, ddof, keepdims]) |
Compute the variance along the specified axis, while ignoring NaNs. |
ndfromtxt(fname, **kwargs) |
Load ASCII data stored in a file and return it as a single array. |
ndim(a) |
Return the number of dimensions of an array. |
nested_iters |
|
newbuffer(size) |
Return a new uninitialized buffer object. |
nonzero(a) |
Return the indices of the elements that are non-zero. |
nper(rate, pmt, pv[, fv, when]) |
Compute the number of periodic payments. |
npv(rate, values) |
Returns the NPV (Net Present Value) of a cash flow series. |
obj2sctype(rep[, default]) |
Return the scalar dtype or NumPy equivalent of Python type of an object. |
ones(shape[, dtype, order]) |
Return a new array of given shape and type, filled with ones. |
ones_like(a[, dtype, order, subok]) |
Return an array of ones with the same shape and type as a given array. |
outer(a, b[, out]) |
Compute the outer product of two vectors. |
packbits(myarray[, axis]) |
Packs the elements of a binary-valued array into bits in a uint8 array. |
pad(array, pad_width[, mode]) |
Pads an array. |
partition(a, kth[, axis, kind, order]) |
Return a partitioned copy of an array. |
percentile(a, q[, axis, out, ...]) |
Compute the qth percentile of the data along the specified axis. |
piecewise(x, condlist, funclist, *args, **kw) |
Evaluate a piecewise-defined function. |
pkgload(*packages, **options) |
Load one or more packages into parent package top-level namespace. |
place(arr, mask, vals) |
Change elements of an array based on conditional and input values. |
pmt(rate, nper, pv[, fv, when]) |
Compute the payment against loan principal plus interest. |
poly(seq_of_zeros) |
Find the coefficients of a polynomial with the given sequence of roots. |
polyadd(a1, a2) |
Find the sum of two polynomials. |
polyder(p[, m]) |
Return the derivative of the specified order of a polynomial. |
polydiv(u, v) |
Returns the quotient and remainder of polynomial division. |
polyfit(x, y, deg[, rcond, full, w, cov]) |
Least squares polynomial fit. |
polyint(p[, m, k]) |
Return an antiderivative (indefinite integral) of a polynomial. |
polymul(a1, a2) |
Find the product of two polynomials. |
polysub(a1, a2) |
Difference (subtraction) of two polynomials. |
polyval(p, x) |
Evaluate a polynomial at specific values. |
ppmt(rate, per, nper, pv[, fv, when]) |
Compute the payment against loan principal. |
prod(a[, axis, dtype, out, keepdims]) |
Return the product of array elements over a given axis. |
product(a[, axis, dtype, out, keepdims]) |
Return the product of array elements over a given axis. |
promote_types(type1, type2) |
Returns the data type with the smallest size and smallest scalar kind to which both type1 and type2 may be safely cast. |
ptp(a[, axis, out]) |
Range of values (maximum - minimum) along an axis. |
put(a, ind, v[, mode]) |
Replaces specified elements of an array with given values. |
putmask(a, mask, values) |
Changes elements of an array based on conditional and input values. |
pv(rate, nper, pmt[, fv, when]) |
Compute the present value. |
rank(a) |
Return the number of dimensions of an array. |
rate(nper, pmt, pv, fv[, when, guess, tol, ...]) |
Compute the rate of interest per period. |
ravel(a[, order]) |
Return a contiguous flattened array. |
ravel_multi_index(multi_index, dims[, mode, ...]) |
Converts a tuple of index arrays into an array of flat indices, applying boundary modes to the multi-index. |
real(val) |
Return the real part of the elements of the array. |
real_if_close(a[, tol]) |
If complex input returns a real array if complex parts are close to zero. |
recfromcsv(fname, **kwargs) |
Load ASCII data stored in a comma-separated file. |
recfromtxt(fname, **kwargs) |
Load ASCII data from a file and return it in a record array. |
repeat(a, repeats[, axis]) |
Repeat elements of an array. |
require(a[, dtype, requirements]) |
Return an ndarray of the provided type that satisfies requirements. |
reshape(a, newshape[, order]) |
Gives a new shape to an array without changing its data. |
resize(a, new_shape) |
Return a new array with the specified shape. |
restoredot() |
Restore dot, vdot, and innerproduct to the default non-BLAS implementations. |
result_type(*arrays_and_dtypes) |
Returns the type that results from applying the NumPy type promotion rules to the arguments. |
roll(a, shift[, axis]) |
Roll array elements along a given axis. |
rollaxis(a, axis[, start]) |
Roll the specified axis backwards, until it lies in a given position. |
roots(p) |
Return the roots of a polynomial with coefficients given in p. |
rot90(m[, k]) |
Rotate an array by 90 degrees in the counter-clockwise direction. |
round(a[, decimals, out]) |
Round an array to the given number of decimals. |
round_(a[, decimals, out]) |
Round an array to the given number of decimals. |
row_stack(tup) |
Stack arrays in sequence vertically (row wise). |
safe_eval(source) |
Protected string evaluation. |
save(file, arr[, allow_pickle, fix_imports]) |
Save an array to a binary file in NumPy .npy format. |
savetxt(fname, X[, fmt, delimiter, newline, ...]) |
Save an array to a text file. |
savez(file, *args, **kwds) |
Save several arrays into a single file in uncompressed .npz format. |
savez_compressed(file, *args, **kwds) |
Save several arrays into a single file in compressed .npz format. |
sctype2char(sctype) |
Return the string representation of a scalar dtype. |
searchsorted(a, v[, side, sorter]) |
Find indices where elements should be inserted to maintain order. |
select(condlist, choicelist[, default]) |
Return an array drawn from elements in choicelist, depending on conditions. |
set_numeric_ops([op1, op2]) |
Set numerical operators for array objects. |
set_printoptions([precision, threshold, ...]) |
Set printing options. |
set_string_function(f[, repr]) |
Set a Python function to be used when pretty printing arrays. |
setbufsize(size) |
Set the size of the buffer used in ufuncs. |
setdiff1d(ar1, ar2[, assume_unique]) |
Find the set difference of two arrays. |
seterr([all, divide, over, under, invalid]) |
Set how floating-point errors are handled. |
seterrcall(func) |
Set the floating-point error callback function or log object. |
seterrobj(errobj) |
Set the object that defines floating-point error handling. |
setxor1d(ar1, ar2[, assume_unique]) |
Find the set exclusive-or of two arrays. |
shape(a) |
Return the shape of an array. |
show_config() |
|
sinc(x) |
Return the sinc function. |
size(a[, axis]) |
Return the number of elements along a given axis. |
sometrue(a[, axis, out, keepdims]) |
Check whether some values are true. |
sort(a[, axis, kind, order]) |
Return a sorted copy of an array. |
sort_complex(a) |
Sort a complex array using the real part first, then the imaginary part. |
source(object[, output]) |
Print or write to a file the source code for a Numpy object. |
split(ary, indices_or_sections[, axis]) |
Split an array into multiple sub-arrays. |
squeeze(a[, axis]) |
Remove single-dimensional entries from the shape of an array. |
stack(arrays[, axis]) |
Join a sequence of arrays along a new axis. |
std(a[, axis, dtype, out, ddof, keepdims]) |
Compute the standard deviation along the specified axis. |
sum(a[, axis, dtype, out, keepdims]) |
Sum of array elements over a given axis. |
swapaxes(a, axis1, axis2) |
Interchange two axes of an array. |
take(a, indices[, axis, out, mode]) |
Take elements from an array along an axis. |
tensordot(a, b[, axes]) |
Compute tensor dot product along specified axes for arrays >= 1-D. |
tile(A, reps) |
Construct an array by repeating A the number of times given by reps. |
trace(a[, offset, axis1, axis2, dtype, out]) |
Return the sum along diagonals of the array. |
transpose(a[, axes]) |
Permute the dimensions of an array. |
trapz(y[, x, dx, axis]) |
Integrate along the given axis using the composite trapezoidal rule. |
tri(N[, M, k, dtype]) |
An array with ones at and below the given diagonal and zeros elsewhere. |
tril(m[, k]) |
Lower triangle of an array. |
tril_indices(n[, k, m]) |
Return the indices for the lower-triangle of an (n, m) array. |
tril_indices_from(arr[, k]) |
Return the indices for the lower-triangle of arr. |
trim_zeros(filt[, trim]) |
Trim the leading and/or trailing zeros from a 1-D array or sequence. |
triu(m[, k]) |
Upper triangle of an array. |
triu_indices(n[, k, m]) |
Return the indices for the upper-triangle of an (n, m) array. |
triu_indices_from(arr[, k]) |
Return the indices for the upper-triangle of arr. |
typename(char) |
Return a description for the given data type code. |
union1d(ar1, ar2) |
Find the union of two arrays. |
unique(ar[, return_index, return_inverse, ...]) |
Find the unique elements of an array. |
unpackbits(myarray[, axis]) |
Unpacks elements of a uint8 array into a binary-valued output array. |
unravel_index(indices, dims[, order]) |
Converts a flat index or array of flat indices into a tuple of coordinate arrays. |
unwrap(p[, discont, axis]) |
Unwrap by changing deltas between values to 2*pi complement. |
vander(x[, N, increasing]) |
Generate a Vandermonde matrix. |
var(a[, axis, dtype, out, ddof, keepdims]) |
Compute the variance along the specified axis. |
vdot(a, b) |
Return the dot product of two vectors. |
vsplit(ary, indices_or_sections) |
Split an array into multiple sub-arrays vertically (row-wise). |
vstack(tup) |
Stack arrays in sequence vertically (row wise). |
where(condition, [x, y]) |
Return elements, either from x or y, depending on condition. |
who([vardict]) |
Print the Numpy arrays in the given dictionary. |
zeros(shape[, dtype, order]) |
Return a new array of given shape and type, filled with zeros. |
zeros_like(a[, dtype, order, subok]) |
Return an array of zeros with the same shape and type as a given array. |
1.7. Classes¶
DataSource([destpath]) |
A generic data source file (file, http, ftp, ...). |
MachAr([float_conv, int_conv, ...]) |
Diagnosing machine parameters. |
PackageLoader([verbose, infunc]) |
|
Tester |
alias of NoseTester |
bool |
Returns True when the argument x is true, False otherwise. |
bool8 |
alias of bool_ |
bool_ |
Numpy’s Boolean type. |
broadcast |
Produce an object that mimics broadcasting. |
busdaycalendar |
A business day calendar object that efficiently stores information defining valid days for the busday family of functions. |
byte |
alias of int8 |
bytes_ |
alias of string_ |
cdouble |
alias of complex128 |
cfloat |
alias of complex128 |
character |
|
chararray |
Provides a convenient view on arrays of string and unicode values. |
clongdouble |
alias of complex256 |
clongfloat |
alias of complex256 |
complex |
Create a complex number from a real part and an optional imaginary part. |
complex128 |
Composed of two 64 bit floats |
complex256 |
Composed of two 128 bit floats |
complex64 |
Composed of two 32 bit floats |
complex_ |
alias of complex128 |
complexfloating |
|
csingle |
alias of complex64 |
datetime64 |
|
double |
alias of float64 |
dtype |
Create a data type object. |
errstate(**kwargs) |
Context manager for floating-point error handling. |
finfo |
Machine limits for floating point types. |
flatiter |
Flat iterator object to iterate over arrays. |
flexible |
|
float |
Convert a string or number to a floating point number, if possible. |
float128 |
128-bit floating-point number. Character code: ‘g’. C long float |
float16 |
|
float32 |
32-bit floating-point number. Character code ‘f’. C float compatible. |
float64 |
64-bit floating-point number. Character code ‘d’. Python float compatible. |
float_ |
alias of float64 |
floating |
|
format_parser(formats, names, titles[, ...]) |
Class to convert formats, names, titles description to a dtype. |
generic |
Base class for numpy scalar types. |
half |
alias of float16 |
iinfo(type) |
Machine limits for integer types. |
inexact |
|
int |
int(x, base=10) -> int or long |
int0 |
alias of int64 |
int16 |
16-bit integer. Character code h. C short compatible. |
int32 |
32-bit integer. Character code ‘i’. C int compatible. |
int64 |
64-bit integer. Character code ‘l’. Python int compatible. |
int8 |
8-bit integer. Character code b. C char compatible. |
int_ |
alias of int64 |
intc |
alias of int32 |
integer |
|
intp |
alias of int64 |
long |
long(x, base=10) -> long |
longcomplex |
alias of complex256 |
longdouble |
alias of float128 |
longfloat |
alias of float128 |
longlong |
alias of int64 |
matrix |
Returns a matrix from an array-like object, or from a string of data. |
memmap |
Create a memory-map to an array stored in a binary file on disk. |
ndarray |
An array object represents a multidimensional, homogeneous array of fixed-size items. |
ndenumerate(arr) |
Multidimensional index iterator. |
ndindex(*shape) |
An N-dimensional iterator object to index arrays. |
nditer |
Efficient multi-dimensional iterator object to iterate over arrays. |
number |
|
object |
The most base type |
object0 |
alias of object_ |
object_ |
Any Python object. |
poly1d(c_or_r[, r, variable]) |
A one-dimensional polynomial class. |
recarray |
Construct an ndarray that allows field access using attributes. |
record |
A data-type scalar that allows field access as attribute lookup. |
short |
alias of int16 |
signedinteger |
|
single |
alias of float32 |
singlecomplex |
alias of complex64 |
str |
Return a nice string representation of the object. |
str_ |
alias of string_ |
string0 |
alias of string_ |
string_ |
|
timedelta64 |
|
ubyte |
alias of uint8 |
ufunc |
Functions that operate element by element on whole arrays. |
uint |
alias of uint64 |
uint0 |
alias of uint64 |
uint16 |
|
uint32 |
|
uint64 |
|
uint8 |
|
uintc |
alias of uint32 |
uintp |
alias of uint64 |
ulonglong |
alias of uint64 |
unicode |
unicode(string[, encoding[, errors]]) -> unicode object |
unicode0 |
alias of unicode_ |
unicode_ |
|
unsignedinteger |
|
ushort |
alias of uint16 |
vectorize(pyfunc[, otypes, doc, excluded, cache]) |
Generalized function class. |
void |
|
void0 |
alias of void |
1.8. Exceptions¶
ComplexWarning |
The warning raised when casting a complex dtype to a real dtype. |
ModuleDeprecationWarning |
Module deprecation warning. |
RankWarning |
Issued by polyfit when the Vandermonde matrix is rank deficient. |
VisibleDeprecationWarning |
Visible deprecation warning. |