MCPcopy Index your code
hub / github.com/numpy/numpy / compressed

Function compressed

numpy/ma/core.py:7275–7311  ·  view source on GitHub ↗

Return all the non-masked data as a 1-D array. This function is equivalent to calling the "compressed" method of a `ma.MaskedArray`, see `ma.MaskedArray.compressed` for details. See Also -------- ma.MaskedArray.compressed : Equivalent method. Examples --------

(x)

Source from the content-addressed store, hash-verified

7273
7274
7275def compressed(x):
7276 """
7277 Return all the non-masked data as a 1-D array.
7278
7279 This function is equivalent to calling the "compressed" method of a
7280 `ma.MaskedArray`, see `ma.MaskedArray.compressed` for details.
7281
7282 See Also
7283 --------
7284 ma.MaskedArray.compressed : Equivalent method.
7285
7286 Examples
7287 --------
7288 >>> import numpy as np
7289
7290 Create an array with negative values masked:
7291
7292 >>> import numpy as np
7293 >>> x = np.array([[1, -1, 0], [2, -1, 3], [7, 4, -1]])
7294 >>> masked_x = np.ma.masked_array(x, mask=x < 0)
7295 >>> masked_x
7296 masked_array(
7297 data=[[1, --, 0],
7298 [2, --, 3],
7299 [7, 4, --]],
7300 mask=[[False, True, False],
7301 [False, True, False],
7302 [False, False, True]],
7303 fill_value=999999)
7304
7305 Compress the masked array into a 1-D array of non-masked values:
7306
7307 >>> np.ma.compressed(masked_x)
7308 array([1, 0, 2, 3, 7, 4])
7309
7310 """
7311 return asanyarray(x).compressed()
7312
7313
7314def concatenate(arrays, axis=0):

Callers

nothing calls this directly

Calls 2

asanyarrayFunction · 0.85
compressedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…