[Python] How can I convert each Pandas Data Frame row into an object including the column...

Discussão em 'Python' iniciado por Stack, Dezembro 21, 2024.

  1. Stack

    Stack Membro Participativo

    Suppose I have a DataFrame including following columns "NAME", "SURNAME", "AGE" and I would like to create one object for each row, including those column values as its variables.

    person = ConvertRow2Object(frame.iloc[0,:])
    print person.NAME //outputs Gary


    How can I do it with a generic solution to any DataFrame with any kind of column names and data types?

    Continue reading...

Compartilhe esta Página