更新时间:2022-12-11 20:23:19
只需选择该列并像往常一样分配:
Just select the column and assign like normal:
In [194]:
df['A'] = 'foo'
df
Out[194]:
A
0 foo
1 foo
2 foo
3 foo
分配标量值会将所有行设置为相同的标量值
Assigning a scalar value will set all the rows to the same scalar value