ValueWithMetadata#
- class mobgap.utils.tables.ValueWithMetadata( )[source]#
A base class to represent a value with associated metadata.
This can be used as a value within a pandas DataFrame, allowing for custom formatting. For this create a subclass that implements the
__str__and_repr_html_methods. The main value provided is still used for comparisons, so you can use this class while allowing for sorting and filtering.Methods
html_styler(st)Apply HTML styling to the DataFrame using the custom HTML representation.
style_html(value)Return a string representation of the value for styling purposes.
- __init__( ) None[source]#
Initialize the ValueWithMetadata object.
- Parameters:
- value
The value to be stored.
- metadata
Optional metadata associated with the value.
- precision
The number of decimal places to use for formatting the value.