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

Function isMaskedArray

numpy/ma/core.py:6685–6734  ·  view source on GitHub ↗

Test whether input is an instance of MaskedArray. This function returns True if `x` is an instance of MaskedArray and returns False otherwise. Any object is accepted as input. Parameters ---------- x : object Object to test. Returns ------- result : b

(x)

Source from the content-addressed store, hash-verified

6683
6684
6685def isMaskedArray(x):
6686 """
6687 Test whether input is an instance of MaskedArray.
6688
6689 This function returns True if `x` is an instance of MaskedArray
6690 and returns False otherwise. Any object is accepted as input.
6691
6692 Parameters
6693 ----------
6694 x : object
6695 Object to test.
6696
6697 Returns
6698 -------
6699 result : bool
6700 True if `x` is a MaskedArray.
6701
6702 See Also
6703 --------
6704 isMA : Alias to isMaskedArray.
6705 isarray : Alias to isMaskedArray.
6706
6707 Examples
6708 --------
6709 >>> import numpy as np
6710 >>> import numpy.ma as ma
6711 >>> a = np.eye(3, 3)
6712 >>> a
6713 array([[ 1., 0., 0.],
6714 [ 0., 1., 0.],
6715 [ 0., 0., 1.]])
6716 >>> m = ma.masked_values(a, 0)
6717 >>> m
6718 masked_array(
6719 data=[[1.0, --, --],
6720 [--, 1.0, --],
6721 [--, --, 1.0]],
6722 mask=[[False, True, True],
6723 [ True, False, True],
6724 [ True, True, False]],
6725 fill_value=0.0)
6726 >>> ma.isMaskedArray(a)
6727 False
6728 >>> ma.isMaskedArray(m)
6729 True
6730 >>> ma.isMaskedArray([0, 1, 2])
6731 False
6732
6733 """
6734 return isinstance(x, MaskedArray)
6735
6736
6737isarray = isMaskedArray

Callers 6

test_testBasic1dMethod · 0.90
test_testBasic2dMethod · 0.90
test_basic1dMethod · 0.90
test_basic2dMethod · 0.90
masked_objectFunction · 0.85

Calls

no outgoing calls

Tested by 5

test_testBasic1dMethod · 0.72
test_testBasic2dMethod · 0.72
test_basic1dMethod · 0.72
test_basic2dMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…