geost.base.DiscreteData.select_by_condition#

DiscreteData.select_by_condition(condition: Any, invert: bool = False)[source]#

Select data using a manual condition that results in a boolean mask. Returns the rows in the data where the ‘condition’ evaluates to True.

Parameters:
  • condition (list, pd.Series or array like) – Boolean array like object with locations at which the values will be preserved, dtype must be ‘bool’ and the length must correspond with the length of the data.

  • invert (bool, optional) – If True, the selection is inverted so rows that evaluate to False will be returned. The default is False.

Returns:

New instance containing only the data objects selected by this method.

Return type:

DiscreteData

Examples

Select rows in data where column values are larger than:

>>> data.select_by_condition(data["column"] > 2)

Or select rows in the data based on multiple conditions:

>>> data.select_by_condition((data["column1"] > 2) & (data["column2] < 1))