You are viewing an older version (2.4.3).Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / ma / core / MaskedArray / tolist

function

numpy.ma.core:MaskedArray.tolist

source: /numpy/ma/core.py:6299

Signature

def tolist(self, fill_value = None)

Summary

Return the data portion of the masked array as a hierarchical Python list.

Extended Summary

Data items are converted to the nearest compatible Python type. Masked values are converted to fill_value. If fill_value is None, the corresponding entries in the output list will be None.

Parameters

fill_value : scalar, optional

The value to use for invalid entries. Default is None.

Returns

result : list

The Python list representation of the masked array.

Examples

import numpy as np
x = np.ma.array([[1,2,3], [4,5,6], [7,8,9]], mask=[0] + [1,0]*4)
x.tolist()
x.tolist(-999)

Aliases

  • numpy.ma.MaskedArray.tolist