spectrochempy.empty
- empty(shape, dtype=None, **kwargs)[source]
Return a new
NDDatasetof given shape and type, without initializing entries.- Parameters:
shape (int or tuple of int) – Shape of the empty array.
dtype (data-type, optional) – Desired output data-type.
**kwargs – Optional keyword parameters (see Other Parameters).
- Returns:
empty – Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.
- Other Parameters:
units (str or ur instance) – Units of the returned object. If not provided, try to copy from the input object.
coordset (list or Coordset object) – Coordinates for the returned object. If not provided, try to copy from the input object.
See also
zeros_likeReturn an array of zeros with shape and type of input.
ones_likeReturn an array of ones with shape and type of input.
empty_likeReturn an empty array with shape and type of input.
full_likeFill an array with shape and type of input.
zerosReturn a new array setting values to zero.
onesReturn a new array setting values to 1.
fullFill a new array.
Notes
empty, unlikezeros, does not set the array values to zero, and may therefore be marginally faster. On the other hand, it requires the user to manually set all the values in the array, and should be used with caution.Examples
>>> scp.empty([2, 2], dtype=int, units='s') NDDataset: [int64] s (shape: (y:2, x:2))