Mask columns of a 2D array that contain masked values. This function is a shortcut to ``mask_rowcols`` with `axis` equal to 1. See Also -------- mask_rowcols : Mask rows and/or columns of a 2D array. masked_where : Mask where a condition is met. Examples --------
(a, axis=np._NoValue)
| 1173 | |
| 1174 | |
| 1175 | def mask_cols(a, axis=np._NoValue): |
| 1176 | """ |
| 1177 | Mask columns of a 2D array that contain masked values. |
| 1178 | |
| 1179 | This function is a shortcut to ``mask_rowcols`` with `axis` equal to 1. |
| 1180 | |
| 1181 | See Also |
| 1182 | -------- |
| 1183 | mask_rowcols : Mask rows and/or columns of a 2D array. |
| 1184 | masked_where : Mask where a condition is met. |
| 1185 | |
| 1186 | Examples |
| 1187 | -------- |
| 1188 | >>> import numpy as np |
| 1189 | >>> a = np.zeros((3, 3), dtype=np.int_) |
| 1190 | >>> a[1, 1] = 1 |
| 1191 | >>> a |
| 1192 | array([[0, 0, 0], |
| 1193 | [0, 1, 0], |
| 1194 | [0, 0, 0]]) |
| 1195 | >>> a = np.ma.masked_equal(a, 1) |
| 1196 | >>> a |
| 1197 | masked_array( |
| 1198 | data=[[0, 0, 0], |
| 1199 | [0, --, 0], |
| 1200 | [0, 0, 0]], |
| 1201 | mask=[[False, False, False], |
| 1202 | [False, True, False], |
| 1203 | [False, False, False]], |
| 1204 | fill_value=1) |
| 1205 | >>> np.ma.mask_cols(a) |
| 1206 | masked_array( |
| 1207 | data=[[0, --, 0], |
| 1208 | [0, --, 0], |
| 1209 | [0, --, 0]], |
| 1210 | mask=[[False, True, False], |
| 1211 | [False, True, False], |
| 1212 | [False, True, False]], |
| 1213 | fill_value=1) |
| 1214 | |
| 1215 | """ |
| 1216 | if axis is not np._NoValue: |
| 1217 | # remove the axis argument when this deprecation expires |
| 1218 | # NumPy 1.18.0, 2019-11-28 |
| 1219 | warnings.warn( |
| 1220 | "The axis argument has always been ignored, in future passing it " |
| 1221 | "will raise TypeError", DeprecationWarning, stacklevel=2) |
| 1222 | return mask_rowcols(a, 1) |
| 1223 | |
| 1224 | |
| 1225 | #####-------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected
searching dependent graphs…