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

Function mask_rows

numpy/ma/extras.py:1046–1094  ·  view source on GitHub ↗

Mask rows of a 2D array that contain masked values. This function is a shortcut to ``mask_rowcols`` with `axis` equal to 0. 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

1044
1045
1046def mask_rows(a, axis=np._NoValue):
1047 """
1048 Mask rows of a 2D array that contain masked values.
1049
1050 This function is a shortcut to ``mask_rowcols`` with `axis` equal to 0.
1051
1052 See Also
1053 --------
1054 mask_rowcols : Mask rows and/or columns of a 2D array.
1055 masked_where : Mask where a condition is met.
1056
1057 Examples
1058 --------
1059 >>> import numpy.ma as ma
1060 >>> a = np.zeros((3, 3), dtype=int)
1061 >>> a[1, 1] = 1
1062 >>> a
1063 array([[0, 0, 0],
1064 [0, 1, 0],
1065 [0, 0, 0]])
1066 >>> a = ma.masked_equal(a, 1)
1067 >>> a
1068 masked_array(
1069 data=[[0, 0, 0],
1070 [0, --, 0],
1071 [0, 0, 0]],
1072 mask=[[False, False, False],
1073 [False, True, False],
1074 [False, False, False]],
1075 fill_value=1)
1076
1077 >>> ma.mask_rows(a)
1078 masked_array(
1079 data=[[0, 0, 0],
1080 [--, --, --],
1081 [0, 0, 0]],
1082 mask=[[False, False, False],
1083 [ True, True, True],
1084 [False, False, False]],
1085 fill_value=1)
1086
1087 """
1088 if axis is not np._NoValue:
1089 # remove the axis argument when this deprecation expires
1090 # NumPy 1.18.0, 2019-11-28
1091 warnings.warn(
1092 "The axis argument has always been ignored, in future passing it "
1093 "will raise TypeError", DeprecationWarning, stacklevel=2)
1094 return mask_rowcols(a, 0)
1095
1096
1097def mask_cols(a, axis=np._NoValue):

Callers 1

polyfitFunction · 0.85

Calls 2

mask_rowcolsFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected