Base.matchingElements¶
- Base.matchingElements(toMatch, points=None, features=None, *, useLog=None)¶
Identify values meeting the provided criteria.
Return a new object with True at every location found to be a match, otherwise False. Common matching functions can be found in nimble’s match module.
- Parameters:
toMatch (value, function, query) –
value - elements equal to the value return True
function - accepts an element as its only argument and returns a boolean value to indicate if the element is a match
query - string in the format ‘OPERATOR VALUE’ representing a function (i.e “< 10”, “== yes”, or “is missing”). See
nimble.match.QueryString
for string requirements.
points (point, list of points) – The subset of points to limit the matching to. If None, the matching will apply to all points.
features (feature, list of features) – The subset of features to limit the matching to. If None, the matching will apply to all features.
useLog (bool, None) – Local control for whether to send object creation to the logger. If None (default), use the value as specified in the “logger” “enabledByDefault” configuration option. If True, send to the logger regardless of the global option. If False, do NOT send to the logger, regardless of the global option.
- Returns:
nimble Base object – This object will only contain boolean values.
See also
Points.matching
,Features.matching
,nimble.match
,countElements
Examples
>>> from nimble import match >>> lst = [[1, -1, 1], [-3, 3, -3]] >>> X = nimble.data(lst) >>> isNegativeOne = X.matchingElements(-1) >>> isNegativeOne <Matrix 2pt x 3ft 0 1 2 ┌──────────────────── 0 │ False True False 1 │ False False False >
>>> from nimble import match >>> lst = [[1, -1, None], [None, 3, -3]] >>> X = nimble.data(lst) >>> isMissing = X.matchingElements(match.missing) >>> isMissing <Matrix 2pt x 3ft 0 1 2 ┌──────────────────── 0 │ False False True 1 │ True False False >
>>> from nimble import match >>> lst = [[1, -1, 1], [-3, 3, -3]] >>> X = nimble.data(lst) >>> isPositive = X.matchingElements(">0") >>> isPositive <Matrix 2pt x 3ft 0 1 2 ┌──────────────────── 0 │ True False True 1 │ False True False >
Keywords: equivalent, identical, same, matches, equals, compare, comparison, same