reVeal.normalization.calc_percentile#

calc_percentile(df, attribute, invert)[source]#

Normalize values from 0 to 1 using percentile ranking.

Parameters:
  • df (pandas.DataFrame) – Input dataframe

  • attribute (str) – Name of attribute to normalize.

  • invert (bool) – If True, invert values by multiplying by -1 before normalizing.

Returns:

pandas.DataFrame – DataFrame with normalized values stored in a column named “value”. Also includes the index from the input dataframe.