numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturns
masked_object(x, value, copy=True, shrink=True)

This function is similar to masked_values , but only suitable for object arrays: for floating point, use masked_values instead.

Parameters

x : array_like

Array to mask

value : object

Comparison value

copy : {True, False}, optional

Whether to return a copy of x.

shrink : {True, False}, optional

Whether to collapse a mask full of False to nomask

Returns

result : MaskedArray

The result of masking x where equal to :None:None:`value`.

Mask the array x where the data are exactly equal to value.

See Also

masked_equal

Mask where equal to a given value (integers).

masked_values

Mask using floating point equality.

masked_where

Mask where a condition is met.

Examples

This example is valid syntax, but we were not able to check execution
>>> import numpy.ma as ma
... food = np.array(['green_eggs', 'ham'], dtype=object)
... # don't eat spoiled food
... eat = ma.masked_object(food, 'green_eggs')
... eat masked_array(data=[--, 'ham'], mask=[ True, False], fill_value='green_eggs', dtype=object)
This example is valid syntax, but we were not able to check execution
>>> # plain ol` ham is boring
... fresh_food = np.array(['cheese', 'ham', 'pineapple'], dtype=object)
... eat = ma.masked_object(fresh_food, 'green_eggs')
... eat masked_array(data=['cheese', 'ham', 'pineapple'], mask=False, fill_value='green_eggs', dtype=object)

Note that :None:None:`mask` is set to nomask if possible.

This example is valid syntax, but we were not able to check execution
>>> eat
masked_array(data=['cheese', 'ham', 'pineapple'],
             mask=False,
       fill_value='green_eggs',
            dtype=object)
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/ma/core.py#2183
type: <class 'function'>
Commit: