O'Reilly logo
  • QIAN Weishuo thinks this is interesting:

A shortcut to select the rows exists with just the indexing operator itself. This is just a shortcut to show additional features of pandas, but the primary function of the indexing operator is actually to select DataFrame columns. If you want to select rows, it is best to use .iloc or .loc, as they are unambiguous.


Cover of Pandas Cookbook


[]一般是用来选列的;但是偶尔也可用来选行。 这有歧义,建议还是用 loc/iloc