geost.base.Collection.compute_discretized_fractions#

Collection.compute_discretized_fractions(column: str, discretization: np.ndarray, bins: int | float | list | np.ndarray = None, bin_centers_as_columns: bool = False, relative_to_reference: bool = False) → Collection[source]#

Calculate the fraction of each categorical value in the specified column of the data table within a given depth discretization. For discretizing continuous values, use the bins parameter to define the ranges.

Parameters:
  • column (str) – Name of the column containing the values to fractionate per discretized layer.

  • discretization (float | int | list | np.ndarray | pd.DataFrame) – Definition of discretization layers. When a scalar is provided, it defines a uniform layer thickness. When a sequence is provided, it defines the specific layer boundaries. When a DataFrame is provided, a custom discretization per survey must be provided. Note that in the case of a DataFrame, the result only contains surveys which had corresponding discretization defined.

  • bins (int | float | list | np.ndarray, optional) – Bin definition. A scalar creates two bins (larger than the scalar and smaller than or equal to the scalar), while a sequence defines internal bin edges and adds open-ended bins at both ends (unless bin_centers_as_columns is True).

  • bin_centers_as_columns (bool, optional) – If True, use bin centers as output column labels rather than ranges. Will not add open-ended bins at both ends, by default False.

  • relative_to_reference (bool, optional) – If True, interpret depths relative to the reference surface, by default False.

Returns:

New Collection containing the discretized fractions as the data table.

Return type:

Collection