📜  pandas 从列表中添加列 - Python 代码示例

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

代码示例3
T = NP.random.randint(0, 10, 20).reshape(5, 4)
c = NP.random.randint(0, 10, 5)
r = NP.random.randint(0, 10, 4)
# add a column to T, at the front:
NP.insert(T, 0, c, axis=1)
# add a column to T, at the end:
NP.insert(T, 4, c, axis=1)
# add a row to T between the first two rows:
NP.insert(T, 2, r, axis=0)