unsupported format string passed to numpy.ndarray

后端 未结 1 905
余生分开走
余生分开走 2021-01-18 18:20

Let\'s say I have the array:

import numpy as np x = np.array([1.2334, 2.3455, 3.456], dtype=np.float32)

and want to print:

相关标签:
1条回答
  • 2021-01-18 18:30

    If you still want format

    list(map('{:.2f}%'.format,x))
    Out[189]: ['1.23%', '2.35%', '3.46%']
    
    0 讨论(0)
提交回复
热议问题