The difference between iloc and loc in pandas

iloc refers to the number of rows and columns, and has no essential relationship with the row and column indexes, but the two can be the same, if and only if the row and column indexes are natural numbers, because it represents the number of rows and columns, so it can only be an integer. Cannot be other types.

loc refers to the row and column indexes. There is no type requirement for the row and column indexes. They can be integers or other types, such as floating point, string, and datetime.

Guess you like

Origin blog.csdn.net/zy1620454507/article/details/130010412