Miscellaneous routines#

Performance tuning#

setbufsize(size)

Set the size of the buffer used in ufuncs.

getbufsize()

Return the size of the buffer used in ufuncs.

Memory ranges#

shares_memory(a, b, /[, max_work])

Determine if two arrays share memory.

may_share_memory(a, b, /[, max_work])

Determine if two arrays might share memory

byte_bounds(a)

Returns pointers to the end-points of an array.

Array mixins#

lib.mixins.NDArrayOperatorsMixin()

Mixin defining all operator special methods using __array_ufunc__.

NumPy version comparison#

lib.NumpyVersion(vstring)

Parse and compare numpy version strings.

Utility#

get_include()

Return the directory that contains the NumPy *.h header files.

show_config()

Show libraries in the system on which NumPy was built.

show_runtime()

Print information about various resources in the system including available intrinsic support and BLAS/LAPACK library in use

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)

Deprecates a function and includes the deprecation in its docstring.

broadcast_shapes(*args)

Broadcast the input shapes into a single shape.

Matlab-like Functions#

who([vardict])

Print the NumPy arrays in the given dictionary.

disp(mesg[, device, linefeed])

Display a message on a device.

Exceptions and Warnings (numpy.exceptions)#

General exceptions used by NumPy. Note that some exceptions may be module specific, such as linear algebra errors.

New in version NumPy: 1.25

The exceptions module is new in NumPy 1.25. Older exceptions remain available through the main NumPy namespace for compatibility.

Warnings#

ComplexWarning

The warning raised when casting a complex dtype to a real dtype.

VisibleDeprecationWarning

Visible deprecation warning.

Exceptions#

AxisError(axis[, ndim, msg_prefix])

Axis supplied was invalid.

DTypePromotionError

Multiple DTypes could not be converted to a common one.

TooHardError

max_work was exceeded.

DType classes and utility (numpy.dtypes)#

This module is home to specific dtypes related functionality and their classes. For more general information about dtypes, also see numpy.dtype and Data type objects (dtype).

Similar to the builtin types module, this submodule defines types (classes) that are not widely used directly.

New in version NumPy: 1.25

The dtypes module is new in NumPy 1.25. Previously DType classes were only accessible indirectly.

DType classes#

The following are the classes of the corresponding NumPy dtype instances and NumPy scalar types. The classes can be used in isinstance checks and can also be instantiated or used directly. Direct use of these classes is not typical, since their scalar counterparts (e.g. np.float64) or strings like "float64" can be used.

Group

DType class

Boolean

BoolDType

Bit-sized integers

Int8DType, UInt8DType, Int16DType, UInt16DType, Int32DType, UInt32DType, Int64DType, UInt64DType

C-named integers (may be aliases)

ByteDType, UByteDType, ShortDType, UShortDType, IntDType, UIntDType, LongDType, ULongDType, LongLongDType, ULongLongDType

Floating point

Float16DType, Float32DType, Float64DType, LongDoubleDType

Complex

Complex64DType, Complex128DType, CLongDoubleDType

Strings

BytesDType, BytesDType

Times

DateTime64DType, TimeDelta64DType

Others

ObjectDType, VoidDType