mlrl.testbed.util.format module¶
Author: Michael Rapp (michael.rapp.ml@gmail.com)
Provides utility functions for creating textual representations.
- mlrl.testbed.util.format.format_number(value: Number, decimals: int = 2) str¶
Creates and returns a textual representation of a value using a specific number of decimals, if the value is a floating point value.
- Parameters:
value – The value
decimals – The number of decimals to be used or 0, if the number of decimals should not be restricted
- Returns:
The textual representation that has been created
- mlrl.testbed.util.format.format_percentage(fraction: float, decimals: int = 2) str¶
Creates and returns a textual representation of a percentage using a specific number of decimals.
- Parameters:
fraction – A fraction in [0, 1] to be formatted as a percentage
decimals – The number of decimals to be used or 0, if the number of decimals should not be restricted
- Returns:
The textual representation that has been created