This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / void

class

numpy:void

source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/__init__.py

Summary

Create a new structured or unstructured void scalar.

Parameters

length_or_data : int, array-like, bytes-like, object

One of multiple meanings (see notes). The length or bytes data of an unstructured void. Or alternatively, the data to be stored in the new scalar when dtype is provided. This can be an array-like, in which case an array may be returned.

dtype : dtype, optional

If provided the dtype of the new scalar. This dtype must be "void" dtype (i.e. a structured or unstructured void, see also defining-structured-types).

Notes

For historical reasons and because void scalars can represent both arbitrary byte data and structured dtypes, the void constructor has three calling conventions:

  • np.void(5) creates a dtype="V5" scalar filled with five

    \0 bytes. The 5 can be a Python or NumPy integer.

  • np.void(b"bytes-like") creates a void scalar from the byte string.

    The dtype itemsize will match the byte string length, here "V10".

  • When a dtype= is passed the call is roughly the same as an

    array creation. However, a void scalar rather than array is returned.

Please see the examples which show all three different conventions.

Examples

np.void(5)
np.void(b'abcd')
np.void((3.2, b'eggs'), dtype="d,S5")
np.void(3, dtype=[('x', np.int8), ('y', np.int8)])
:Character code: ``'V'``

Aliases

  • numpy.void

Referenced by