INNER CODE UNIT · Python

_surpress_formatting_errors

HHammond/PrettyPandas · prettypandas/formatters.py:12

def _surpress_formatting_errors(fn):
    """
    I know this is dangerous and the wrong way to solve the problem, but when
    using both row and columns summaries it's easier to just swallow errors
    so users can format their tables how they need.
    """
    @wraps(fn)
    def inner(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except ValueError:
            return ""
    return inner


def _format_numer(number_format, prefix='', suffix=''):
    """Format a number to a string."""
    @_surpress_formatting_errors

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…