Numpy将字符串数组转换为浮点数数组

e.g.

import numpy as np
x = np.array(['1.1', '1.2', '1.3'])
y = x.astype(np.float)

输出结果:
Python 3.8.1 (default, Jan 8 2020, 16:15:59)
[Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
import numpy as np
…: x = np.array([‘1.1’, ‘2.2’, ‘3.3’])
…: y = x.astype(np.float)
print(x)
[‘1.1’ ‘2.2’ ‘3.3’]
print(y)
[1.1 2.2 3.3]