📜  将选择列组设置为数字熊猫 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:43.236000             🧑  作者: Mango

代码示例1
import pandas as pd

df = pd.DataFrame({'id':['a1', 'a2', 'a3', 'a4'],
                     'A':['0', '1', '2', '3'],
                   'B':['1', '1', '1', '1'],
                   'C':['0', '1', '1', '0']})

df[['A', 'B', 'C']] = df[['A', 'B', 'C']].apply(pd.to_numeric, axis = 1)