[Python] Pandas - rearrange columns if column exists

Discussão em 'Python' iniciado por Stack, Março 18, 2025.

  1. Stack

    Stack Membro Participativo

    I have a dataframes that are in jumbled order how can I rearrange the columns if they exits.

    One Two Three Six Four Five
    1 2 3 6 4 5
    1 2 3 6 4 5
    ...


    How can I arrange this columns in order? The issue here is that all six column might not be there in all occasions. So I need a simple line that can arrange it in order of One Two Three Four Five Six if that column exits. I mean if Two is not in df then it should be One Three Four Five Six

    Continue reading...

Compartilhe esta Página