【Python】How to print only 3 decimal places in python numpy array? - 101 Numpy Exercises
Q:
小数点を三桁のみ表示するようにしなさい
A:
# Create the random array rand_arr = np.random.random([5,3]) # Limit to 3 decimal places np.set_printoptions(precision=3) rand_arr[:4] #> array([[ 0.443, 0.109, 0.97 ], #> [ 0.388, 0.447, 0.191], #> [ 0.891, 0.474, 0.212], #> [ 0.609, 0.518, 0.403]])