[Python] How to transpose and modify a pandas dataframe based on column values

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

  1. Stack

    Stack Membro Participativo

    I have a set of data like below:

    name A B C
    foo 1 0 0
    bar 0 1 0
    coo 0 0 1


    That I am trying to alter to look like the table below:

    name
    A foo
    B bar
    C coo


    I've done research but have gotten no luck. I'm not sure if it is possible within python. Do I need to manually change this table to get the result I am looking for?

    Continue reading...

Compartilhe esta Página