📜  如何使用 panda 对象重命名列 - Python 代码示例

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

代码示例6
df2.columns = stocks['Ticker'][:3]

[:3] is just use first 3
[5::] skip first 5



                price price  price 
2021-01-11    131.90    15.00    179.07
2021-01-12    128.09    15.74    182.65

to

Ticker    A    AAL    AAP
2021-01-11    131.90    15.00    179.07
2021-01-12    128.09    15.74    182.65