【发布时间】:2021-05-31 09:09:13
【问题描述】:
我有一个 numpy 数组大小 (8634,3),其中包含英语和德语混合类型的数值,例如。 34,12 和 34.15
X = np.array(df[['column_a','column_b','column_c']])
X.shape
(8634,3)
X.dtype
dtype('O')
我想将“,”替换为“。”使用此功能:
int_X = X.replace(',','.')
但我收到此错误:
AttributeError: 'numpy.ndarray' object has no attribute 'replace'
有人可以帮助我使用我需要使用的正确功能吗?谢谢
【问题讨论】:
标签: python pandas dataframe replace type-conversion