scientific notation for significant figures has been included as a function in numpy version 1.21.0. as of 18.08.2024:
import numpy as np
float(np.format_float_scientific(12.3456789, precision=4))
https://numpy.org/doc/stable/reference/generated/numpy.format_float_scientific.html
I think that makes most of the other answers redundant.