toad.utils.mixin module¶
-
class
toad.utils.mixin.
RulesMixin
[source]¶ Bases:
object
-
rules
¶
-
load
(rules, update=False, **kwargs)[source]¶ load rules from dict or json file
Parameters: - rules (dict) – dictionary of rules
- from_json (str|IOBase) – json file of rules
- update (bool) – if need to use updating instead of replacing rules
-
-
class
toad.utils.mixin.
BinsMixin
[source]¶ Bases:
object
-
EMPTY_BIN
= -1¶
-
ELSE_GROUP
= 'else'¶
-
NUMBER_EXP
= re.compile('\\[(-inf|-?\\d+(.\\d+)?)\\s*[~-]\\s*(inf|-?\\d+(.\\d+)?)\\)')¶
-
classmethod
format_bins
(bins, index=False, ellipsis=None)[source]¶ format bins to label
Parameters: - bins (ndarray) – bins to format
- index (bool) – if need index prefix
- ellipsis (int) – max length threshold that labels will not be ellipsis, None for skipping ellipsis
Returns: array of labels
Return type: ndarray
-