great_expectations.render.util

Rendering utility

Module Contents

Functions

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

ordinal(num)

Convert a number to ordinal

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:

https://stackoverflow.com/questions/38847690/convert-float-to-string-in-positional-format-without-scientific-notation-and-fa

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