geost.accessor.GeostFrame.slice_by_values#

GeostFrame.slice_by_values(column: str, values: int | float | str | Iterable | slice, invert: bool = False, inclusive: str = 'both') DataFrame[source]#

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.

  • values (int | float | str | Iterable | slice) – Value or array-like set of values to look for in the column. In case of numerical values, a slice can be used to slice a range of values, see example below.

  • invert (bool, optional) – If True, invert the slicing action, so remove layers with selected values instead of keeping them. The default is False.

  • inclusive ({"both", "neither", "left", "right"}, optional) – When a slice is used for selection to include boundaries or not. The default is “both”.

Returns:

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

Return type:

pd.DataFrame

Examples

Return only rows in data contain sand (“Z”) as lithology:

>>> sliced = data.gst.slice_by_values("lith", "Z")

If you want all the rows that may contain everything but sand, use the “invert” option:

>>> sliced = data.gst.slice_by_values("lith", "Z", invert=True)

If you want to slice a range of numerical values, you can use a slice. For example, to return only rows where the cone resistance (“qc”) is between 15 and 20 MPa:

>>> sliced = data.gst.slice_by_values("qc", slice(15, 20))