【发布时间】:2019-02-18 21:53:11
【问题描述】:
我需要将列(熊猫数据框)的数值转换为浮点数,但它们是字符串格式。
d = {'col1': ['1', '2.1', '3.1'],
'col2': ['yes', '4', '6'],
'col3': ['1', '4', 'not']}
预期:
{'col1': [1, 2.1, 3.1],
'col2': ['yes', 4, 6],
'col3': [1, 4, 'not']}
【问题讨论】:
标签: python pandas formatting