Note
Numpy (22) 본문
728x90
How to pretty print a numpy array by suppressing the scientific notation (like 1e10)?
# Reset printoptions to default
np.set_printoptions(suppress=False)
# Create the random array
np.random.seed(100)
rand_arr = np.random.random([3,3])/1e3
# output
array([[ 5.434049e-04, 2.783694e-04, 4.245176e-04],
[ 8.447761e-04, 4.718856e-06, 1.215691e-04],
[ 6.707491e-04, 8.258528e-04, 1.367066e-04]])
np.set_printoptions(suppress=True, precision=6) # precision is optional
rand_arr
# output
array([[ 0.000543, 0.000278, 0.000425],
[ 0.000845, 0.000005, 0.000122],
[ 0.000671, 0.000826, 0.000137]])
'Numpy' 카테고리의 다른 글
Numpy (24) (0) | 2022.08.15 |
---|---|
Numpy (23) (0) | 2022.08.14 |
Numpy (21) (0) | 2022.08.12 |
Numpy (20) (0) | 2022.08.11 |
Numpy (19) (0) | 2022.08.10 |
Comments