great_expectations.render.util
¶
Rendering utility
Module Contents¶
Functions¶
|
Convert the given float to a string, centralizing standards for precision and decisions about scientific |
|
Convert a number to ordinal |
|
|
|
Utility function to plug Nones in when optional parameters are not specified in expectation kwargs. |
|
|
|
Utility function for the at least and at most conditions based on strictness. |
-
great_expectations.render.util.
DEFAULT_PRECISION
= 4¶
-
great_expectations.render.util.
ctx
¶
-
great_expectations.render.util.
prec
¶
-
great_expectations.render.util.
num_to_str
(f, precision=DEFAULT_PRECISION, use_locale=False, no_scientific=False)¶ Convert the given float to a string, centralizing standards for precision and decisions about scientific notation. Adds an approximately equal sign in the event precision loss (e.g. rounding) has occurred.
- There’s a good discussion of related issues here:
- Parameters
f – the number to format
precision – the number of digits of precision to display
use_locale – if True, use locale-specific formatting (e.g. adding thousands separators)
no_scientific – if True, print all available digits of precision without scientific notation. This may insert leading zeros before very small numbers, causing the resulting string to be longer than precision characters
- Returns
A string representation of the float, according to the desired parameters
-
great_expectations.render.util.
SUFFIXES
¶
-
great_expectations.render.util.
ordinal
(num)¶ Convert a number to ordinal
-
great_expectations.render.util.
resource_key_passes_run_name_filter
(resource_key, run_name_filter)¶
-
great_expectations.render.util.
substitute_none_for_missing
(kwargs, kwarg_list)¶ Utility function to plug Nones in when optional parameters are not specified in expectation kwargs.
Example
- Input:
kwargs={“a”:1, “b”:2}, kwarg_list=[“c”, “d”]
Output: {“a”:1, “b”:2, “c”: None, “d”: None}
This is helpful for standardizing the input objects for rendering functions. The alternative is lots of awkward if “some_param” not in kwargs or kwargs[“some_param”] == None: clauses in renderers.
-
great_expectations.render.util.
parse_row_condition_string_pandas_engine
(condition_string)¶
-
great_expectations.render.util.
handle_strict_min_max
(params: dict) -> (str, str)¶ Utility function for the at least and at most conditions based on strictness.
- Parameters
params – dictionary containing “strict_min” and “strict_max” booleans.
- Returns
tuple of strings to use for the at least condition and the at most condition