Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.ma.MaskedArray.tobytes

MaskedArray.tobytes(fill_value=None,order='C')[source]

Return the array data as a string containing the raw bytes in the array.

The array is filled with a fill value before the string conversion.

New in version 1.9.0.

Parameters:

fill_value : scalar, optional

Value used to fill in the masked values. Default is None, in whichcaseMaskedArray.fill_value is used.

order : {‘C’,’F’,’A’}, optional

Order 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’.

See also

ndarray.tobytes,tolist,tofile

Notes

As forndarray.tobytes, information about the shape, dtype, etc.,but also aboutfill_value, will be lost.

Examples

>>>x=np.ma.array(np.array([[1,2],[3,4]]),mask=[[0,1],[1,0]])>>>x.tobytes()'\x01\x00\x00\x00?B\x0f\x00?B\x0f\x00\x04\x00\x00\x00'

Previous topic

numpy.ma.MaskedArray.tostring

Next topic

numpy.ma.MaskedArray.flatten

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp