这个问题在这里已有答案:
max_speed shield new
1 1 2 3
2 4 5 6
我得到了这个数据帧,我想根据一些列名分配一个值。像这样df.loc [df ['max_speed'] == 1,df ['shield'] == 2,new] = 10然后我会得到新的数据帧:
max_speed shield new
1 1 2 10
2 4 5 6
谁知道怎么做?
如果您想在不符合条件的情况下更改值,请选择qazxsw boi:
where