Is it possible to set the number of digits to be used for printing the exponent of a floating-point number? I want to set it to 3.
Currently,
f = 0.0
You can use np.format_float_scientific
from numpy import format_float_scientific f = 0.0000870927939438012 format_float_scientific(f, exp_digits=3) # prints '8.70927939438012e-005' format_float_scientific(f, exp_digits=5, precision=2) #prints '8.71e-00005'