def set_sig_figs ( n = 4 ) : u . default_format = '.' + str ( n ) + 'g' pd . options . display . float_format = ( '{:,.' + str ( n ) + '}' ) . format
how to specify the number of digits in python floats
Set the number of significant figures used to print Pint Pandas and NumPy quantities .
def set_sig_figs(n=4):
    """Set the number of significant figures used to print Pint, Pandas, and
    NumPy quantities.

    Args:
        n (int): Number of significant figures to display.
    """
    u.default_format = '.' + str(n) + 'g'
    pd.options.display.float_format = ('{:,.' + str(n) + '}').format