watex.utils.select_base_stratum#
- watex.utils.select_base_stratum(d, /, sname=None, stratum=None, return_rate=False, return_counts=False)[source]#
Selects base stratum from the the strata column in the logging data.
Find the most recurrent stratum in the data and compute the rate of occurrence.
- Parameters
d (array-like 1D , pandas.Series or DataFrame) – Valid data containing the strata. If dataframe is passed, ‘sname’ is needed to fetch strata values.
sname (str, optional) – Name of column in the dataframe that contains the strata values. Dont confuse ‘sname’ with ‘stratum’ which is the name of the valid layer/rock in the array/Series of strata.
stratum (str, optional) – Name of the base stratum. Must be self contain as an item of the strata data. Note that if stratum is passed, the auto-detection of base stratum is not triggered. It returns the same stratum , however it can gives the rate and occurence of this stratum if return_rate or return_counts is set to
True.return_rate (bool,default=False,) – Returns the rate of occurence of the base stratum in the data.
return_counts (bool, default=False,) – Returns each stratum name and the occurences (count) in the data.
- Returns
bs (str) – base stratum , self contain in the data
r (float) – rate of occurence in base stratum in the data
c (tuple (str, int)) – Tuple of each stratum whith their occurrence in the data.
Example
>>> from watex.datasets import load_hlogs >>> from watex.utils.hydroutils import select_base_stratum >>> data = load_hlogs().frame # get only the frame >>> select_base_stratum(data, sname ='strata_name') ... 'siltstone' >>> select_base_stratum(data, sname ='strata_name', return_rate =True) ... 0.287292817679558 >>> select_base_stratum(data, sname ='strata_name', return_counts=True) ... [('siltstone', 52), ('fine-grained sandstone', 40), ('mudstone', 37), ('coal', 24), ('Coarse-grained sandstone', 15), ('carbonaceous mudstone', 9), ('medium-grained sandstone', 2), ('topsoil', 1), ('gravel layer', 1)]