python iloc() [[],[]] double list input

data called frame

A B C D
a 0.560094 0.352686 0.954100
b 0.563728 0.335517 0.232902
c 0.482155 0.976618 0.565462
d 0.477146 0.933353 0.291764

若取[第一行和第四行]、[第一列和第四列]对应的数据:

code

frame.iloc[[0,3],[0,3]]

code meaning

frame.iloc[[the 1 th row, the 4th row],[the 1th column, the 4th column]]

code result

A D
a 0.560094 0.926277
d 0.477146 0.986668
posted @ 2022-11-06 20:01  杜明睿Miguel  阅读(23)  评论(0)    收藏  举报