我尝试过theis解决方案,但这并不能真正解决我的问题
x = ['a', 'b', 'c', 'd', 'e', 'f']
y = np.array(['10', '20', '30', '40', '50', '60'])
z = np.array(['x', 'y', 'z', 'f', 'b', 's'])
df_vaex = vaex.from_arrays(x=x, y=y, z=z)
df_vaex.y = df_vaex.y.astype('float64')
print(df_vaex.dtypes)
x <class 'str'>
y <class 'str'>
z <class 'str'>
dtype: object
如何将字符串列转换为数字?谢谢。
答案 0 :(得分:0)
我找到了解决方法https://github.com/vaexio/vaex/issues/944
df_vaex['y'] = df_vaex.y.astype('float64')