我在试图打印基于index values
的行时遇到了一些问题
>>>in: print(df) # My table when I print df
>>>out:
Item Column1 Column2 Column3 Column4 Column5
Fooooo 64.318 7.574 0.471 0.364 -
Yooooo 56.839 7.252 (1.914) (1.945) (0.015)
Zaaaaa 45.275 7.186 (7.109) (1.611) (0.016)
Zorrrr 0.381 0.063 (5.305) (1.6) (0.017)
Kaarrr 1.325 0.26 (5.514) (2.563) (0.019)
预期结果
如何通过index
分离df
,从而产生下面的结果?你知道吗
>>>in: print(df index['Fooooo']) # For example
>>>out:
Item Column1 Column2 Column3 Column4 Column5
Fooooo 64.318 7.574 0.471 0.364 -
>>>in: print(df index['Yooooo']) # For example
>>>out:
Item Column1 Column2 Column3 Column4 Column5
Yooooo 56.839 7.252 (1.914) (1.945) (0.015)
>>>in: print(df index['Zaaaaa']) # For example
>>>out:
Item Column1 Column2 Column3 Column4 Column5
Zaaaaa 45.275 7.186 (7.109) (1.611) (0.016)
我试过了
print(df.index[0])
-这只是给了我Item
。不会与Columns
的其余部分一起出现
您可以使用ix:
尝试筛选方法:
相关问题 更多 >
编程相关推荐