watex.utils.classify_k#
- watex.utils.classify_k(o, /, func=None, kname=None, inplace=False, string=False, default_func=False)[source]#
Categorize the permeability coefficient ‘k’
Map the continuous ‘k’ into categorial classes.
- Parameters:
o (ndarray of pd.Series or Dataframe) – data containing the permeability coefficient k contineous values. If data is passsed as a pandas dataframe, the column containing the k-values kname needs to be specified.
func (callable) – Function to specifically map the permeability coefficient column in the dataframe of serie. If not given, the default function can be enabled instead from param default_func.
inplace (bool, default=False) – Modified object inplace and return None
string (bool,) – If set to “True”, categorized map from ‘k’ should be prefixed by “k”. However is string value is given , the prefix is changed according to this label.
default_ufunc (bool,) –
Default function for mapping k is setting to
True. Note that, this could probably not fitted your own data. So it is recommended to provide your own function for mapping ‘k’. However the default ‘k’ mapping is given as follow:k0 {0}: k = 0
k1 {1}: 0 < k <= .01
k2 {2}: .01 < k <= .07
k3 {3}: k> .07
- Returns:
o – return None only if dataframe is given and inplace is set to
Truei.e modified object inplace.- Return type:
None, ndarray, Series or Dataframe
Examples
>>> import numpy as np >>> from watex.datasets import load_hlogs >>> from watex.utils.hydroutils import classify_k >>> _, y0 = load_hlogs (as_frame =True) >>> # let visualize four nonzeros values in y0 >>> y0.k.values [ ~np.isnan (y0.k ) ][:4] ... array([0.054, 0.054, 0.054, 0.054]) >>> classify_k (y0 , kname ='k', inplace =True, use_default_func=True ) >>> # let see again the same four value in the dataframe >>> y0.k.values [ ~np.isnan (y0.k ) ][:4] ... array([2., 2., 2., 2.])