Suppress whole columns of a 2-D array that contain masked values. This is equivalent to ``np.ma.compress_rowcols(a, 1)``, see `compress_rowcols` for details. Parameters ---------- x : array_like, MaskedArray The array to operate on. If not a MaskedArray instance (
(a)
| 992 | |
| 993 | |
| 994 | def compress_cols(a): |
| 995 | """ |
| 996 | Suppress whole columns of a 2-D array that contain masked values. |
| 997 | |
| 998 | This is equivalent to ``np.ma.compress_rowcols(a, 1)``, see |
| 999 | `compress_rowcols` for details. |
| 1000 | |
| 1001 | Parameters |
| 1002 | ---------- |
| 1003 | x : array_like, MaskedArray |
| 1004 | The array to operate on. If not a MaskedArray instance (or if no array |
| 1005 | elements are masked), `x` is interpreted as a MaskedArray with |
| 1006 | `mask` set to `nomask`. Must be a 2D array. |
| 1007 | |
| 1008 | Returns |
| 1009 | ------- |
| 1010 | compressed_array : ndarray |
| 1011 | The compressed array. |
| 1012 | |
| 1013 | See Also |
| 1014 | -------- |
| 1015 | compress_rowcols |
| 1016 | |
| 1017 | Examples |
| 1018 | -------- |
| 1019 | >>> import numpy as np |
| 1020 | >>> a = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0], |
| 1021 | ... [1, 0, 0], |
| 1022 | ... [0, 0, 0]]) |
| 1023 | >>> np.ma.compress_cols(a) |
| 1024 | array([[1, 2], |
| 1025 | [4, 5], |
| 1026 | [7, 8]]) |
| 1027 | |
| 1028 | """ |
| 1029 | a = asarray(a) |
| 1030 | if a.ndim != 2: |
| 1031 | raise NotImplementedError("compress_cols works for 2D arrays only.") |
| 1032 | return compress_rowcols(a, 1) |
| 1033 | |
| 1034 | |
| 1035 | def mask_rowcols(a, axis=None): |
nothing calls this directly
no test coverage detected
searching dependent graphs…