MCPcopy Create free account
hub / github.com/numpy/numpy / tolist

Method tolist

numpy/ma/mrecords.py:391–405  ·  view source on GitHub ↗

Return the data portion of the array as a list. 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``.

(self, fill_value=None)

Source from the content-addressed store, hash-verified

389 return copied
390
391 def tolist(self, fill_value=None):
392 """
393 Return the data portion of the array as a list.
394
395 Data items are converted to the nearest compatible Python type.
396 Masked values are converted to fill_value. If fill_value is None,
397 the corresponding entries in the output list will be ``None``.
398
399 """
400 if fill_value is not None:
401 return self.filled(fill_value).tolist()
402 result = np.array(self.filled().tolist(), dtype=object)
403 mask = np.array(self._mask.tolist())
404 result[mask] = None
405 return result.tolist()
406
407 def __getstate__(self):
408 """Return the internal state of the masked array.

Callers 1

fromrecordsFunction · 0.45

Calls 1

filledMethod · 0.45

Tested by

no test coverage detected