[英]finding a row index and column index value in Pandas
To get it, you have to use iloc in the following way:要获得它,您必须按以下方式使用 iloc:
print(df.iloc[1][1])
You can use the.iloc attribute.您可以使用 .iloc 属性。 Below is an example:
下面是一个例子:
df.iloc[1,2]
This gets the object at row 1 and column 2.这将在第 1 行和第 2 列获得 object。
You can even splice using a colon.您甚至可以使用冒号进行拼接。 Example:
例子:
df.iloc[2:5 , 3:8]
This gets all the elements from rows 2 to 5 and 3 to 8.这将获取第 2 行到第 5 行和第 3 行到第 8 行的所有元素。
More information on iloc can be found here:关于 iloc 的更多信息可以在这里找到:
https://thispointer.com/select-rows-columns-by-name-or-index-in-dataframe-using-loc-iloc-python-pandas/ https://thispointer.com/select-rows-columns-by-name-or-index-in-dataframe-using-loc-iloc-python-pandas/
Hope this helps希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.