Categories

The Categories class is used to define categories by which DataSets (in particular, Tables) can be categorized. Users add categories as dictionaries where the key is a string describing the category and the value is a list of values that should be assigned the category. The user selects a categorizer (either IS_EQUAL or IS_IN) to determine whether values should be exact matches to category values or whether they can have category values as substrings.

class chromaquant.utils.categories.Categories

Class that is used to define categories by which Tables can be categorized.

Raises

AttributeError

If the IS_IN method is used for non-string values or keywords.

IS_EQUAL(test_value: str | int | float) str

A categorizer that finds when a tested value is equal to a keyword, returning the first applicable category if more than one apply.

Parameters

test_valuestr | int | float

Value to categorize.

Returns

categorystr

The applicable category for the test_value.

IS_IN(test_value: str) str

A categorizer that finds when a tested value is contains a keyword, returning the first applicable category if more than one apply.

Parameters

test_valuestr

Value to categorize.

Returns

categorystr

The applicable category for the test_value.