geost.base.CptCollection.slice_by_values#
- CptCollection.slice_by_values(column: str, selection_values: str | Iterable, invert: bool = False)#
Slice rows from data based on matching condition. E.g. only return rows with a certain lithology in the collection object.
- Parameters:
column (str) – Name of column that contains categorical data to use when looking for values.
selection_values (str | Iterable) – Values to look for in the column.
invert (bool, optional) – If True, invert the slicing action, so remove layers with selected values instead of keeping them. The default is False.
- Returns:
New instance of the current object containing only the selection resulting from application of this method. e.g. if you are calling this method from a Collection, you will get an instance of a Collection back.
- Return type:
New instance of the current object.
Examples
Return only rows in borehole data contain sand (“Z”) as lithology:
>>> boreholes.slice_by_values("lith", "Z")
If you want all the rows that may contain everything but sand, use the “invert” option:
>>> boreholes.slice_by_values("lith", "Z", invert=True)