geost.base.BoreholeCollection.select_by_condition#
- BoreholeCollection.select_by_condition(condition: Any, invert: bool = False)#
Select from collection.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:
Examples
Select rows in borehole data that contain a specific value:
>>> boreholes.select_by_condition(boreholes["lith"]=="V")
Or select rows in the borehole data that contain a specific (part of) string or strings:
>>> boreholes.select_by_condition(boreholes["column"].str.contains("foo|bar"))