Jun-07-2023, 07:35 AM
As I suggested:
import numpy as np a = np.array([-1.784, -1.5888, -0.24444, 0.25555, 1.5, 1.75, 2.0]) a_rounded = np.around(a, decimals=2) print(f"{a_rounded}")
Output:[-1.78 -1.59 -0.24 0.26 1.5 1.75 2. ]
Actually I'm just wondering if that's your need or if you're asking as well for "zeros" to complete decimals; for instance "1.5" and "2." must provide "1.50" and "2.00" respectively