def sinum_frmt(x):
    """
    Generate SIunitx style formatted number output for plotting tables to TeX.

    This function can be used as a formatter for printing DataFrames to Latex
    tabes when using the Latex package SIunitx.

    Parameters
    ----------
    x : int, float
        Value to format.

    Returns
    -------
    str
        Formatted value.

    """
    if isinstance(x, (int, float)):
        if x < 1e3:
            return r'\num{' + '{0:.3G}'.format(x) + '}'
        elif x >= 1e3:
            return r'\num{' + '{0:.0f}'.format(x) + '}'
        else:  # x is nan
            return '-'
    else:
        return x