bundles / numpy latest / numpy / ma / core / MaskedArray / tobytes
function
numpy.ma.core:MaskedArray.tobytes
source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py:6351
Signature
def tobytes(self, fill_value = None, order = C)Summary
Return the array data as a string containing the raw bytes in the array.
Extended Summary
The array is filled with a fill value before the string conversion.
Parameters
fill_value: scalar, optionalValue used to fill in the masked values. Default is None, in which case MaskedArray.fill_value is used.
order: {'C','F','A'}, optionalOrder of the data item in the copy. Default is 'C'.
'C' -- C order (row major).
'F' -- Fortran order (column major).
'A' -- Any, current order of array.
None -- Same as 'A'.
Notes
As for ndarray.tobytes, information about the shape, dtype, etc., but also about fill_value, will be lost.
Examples
import numpy as np x = np.ma.array(np.array([[1, 2], [3, 4]]), mask=[[0, 1], [1, 0]]) x.tobytes()
See also
Aliases
numpy.ma.MaskedArray.tobytes