ijazz.categorize
Functions
|
Create the categories for both lepton based on a dataframe containing the categorisation variable per lepton |
Module Contents
- ijazz.categorize.categorize(df: pandas.DataFrame, category_dict: dict, cut='', prefix='cat', var_prefixes=None, var_suffixes=['1', '2']) numpy.ndarray[source]
Create the categories for both lepton based on a dataframe containing the categorisation variable per lepton under the form var1, var2 for lepton 1 and lepton 2, the name of the variables to categorize upon are specified in the the category dictionnary along with the corresponding bining.
- Parameters:
df (pd.DataFrame) – input dataframe containing the variable to categorize
category_dict (dict) – dictionary for categorisation, e.g. {‘pt’: [25, 50, 100], ‘abs_eta’: [0, 1, 2]}
cut (str, optional) – cut to be use if df.eval(cut) to apply a selection. Defaults to “”.
prefix (str, optional) – prefix used for the categorisation. Defaults to ‘cat’.
- Returns:
array with the category numbers that have been created
- Return type:
np.ndarray