示例数据框:
class fred bill
0 a 23 35
1 b 123 45
2 c 34 45
3 d 4 45
(熊猫添加了不需要的索引(0-> 3))
我想要说的是这样的:
fred_b_class = df.at['fred','b']
>>> 123
我尝试将列设置'class'
为索引pd.set_index('class')
但是,调用df.index.name
时返回none
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句