[Python] Pandas indexing

Discussão em 'Python' iniciado por Stack, Fevereiro 19, 2025.

  1. Stack

    Stack Membro Participativo

    Can someone explain what is meant by


    Both loc and iloc [in Pandas] are row-first, column-second. This is the opposite of what we do in native Python, which is column-first, row-second.
    ​

    Because I thought when accessing arrays or lists of lists, the first index always represents the row:

    matrix = [
    [1,2,3], # row 1, index 0
    [4,5,6], # row 2, index 1
    [7,8,9] # row 3, index 2
    ]
    print(matrix[1][2]) # Output = 6

    Continue reading...

Compartilhe esta Página