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)
| 423 | return copied |
| 424 | |
| 425 | def tolist(self, fill_value=None): |
| 426 | """ |
| 427 | Return the data portion of the array as a list. |
| 428 | |
| 429 | Data items are converted to the nearest compatible Python type. |
| 430 | Masked values are converted to fill_value. If fill_value is None, |
| 431 | the corresponding entries in the output list will be ``None``. |
| 432 | |
| 433 | """ |
| 434 | if fill_value is not None: |
| 435 | return self.filled(fill_value).tolist() |
| 436 | result = narray(self.filled().tolist(), dtype=object) |
| 437 | mask = narray(self._mask.tolist()) |
| 438 | result[mask] = None |
| 439 | return result.tolist() |
| 440 | |
| 441 | def __getstate__(self): |
| 442 | """Return the internal state of the masked array. |