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

Function mask_cols

numpy/ma/extras.py:1097–1144  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1095
1096
1097def mask_cols(a, axis=np._NoValue):
1098 """
1099 Mask columns of a 2D array that contain masked values.
1100
1101 This function is a shortcut to ``mask_rowcols`` with `axis` equal to 1.
1102
1103 See Also
1104 --------
1105 mask_rowcols : Mask rows and/or columns of a 2D array.
1106 masked_where : Mask where a condition is met.
1107
1108 Examples
1109 --------
1110 >>> import numpy.ma as ma
1111 >>> a = np.zeros((3, 3), dtype=int)
1112 >>> a[1, 1] = 1
1113 >>> a
1114 array([[0, 0, 0],
1115 [0, 1, 0],
1116 [0, 0, 0]])
1117 >>> a = ma.masked_equal(a, 1)
1118 >>> a
1119 masked_array(
1120 data=[[0, 0, 0],
1121 [0, --, 0],
1122 [0, 0, 0]],
1123 mask=[[False, False, False],
1124 [False, True, False],
1125 [False, False, False]],
1126 fill_value=1)
1127 >>> ma.mask_cols(a)
1128 masked_array(
1129 data=[[0, --, 0],
1130 [0, --, 0],
1131 [0, --, 0]],
1132 mask=[[False, True, False],
1133 [False, True, False],
1134 [False, True, False]],
1135 fill_value=1)
1136
1137 """
1138 if axis is not np._NoValue:
1139 # remove the axis argument when this deprecation expires
1140 # NumPy 1.18.0, 2019-11-28
1141 warnings.warn(
1142 "The axis argument has always been ignored, in future passing it "
1143 "will raise TypeError", DeprecationWarning, stacklevel=2)
1144 return mask_rowcols(a, 1)
1145
1146
1147#####--------------------------------------------------------------------------

Callers 1

corrcoefFunction · 0.85

Calls 2

mask_rowcolsFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected