[Python] Create new dataframe rows when column has comma delimited values

Discussão em 'Python' iniciado por Stack, Outubro 23, 2024.

  1. Stack

    Stack Membro Participativo

    Example dataframe:

    name col1 col2 col3
    bob bird 78 1000
    alice cat 55 500,600,700
    rob dog 333 20,30


    Desired Dataframe that adds rows when col3 has comma delimited string values:

    name col1 col2 col3
    bob bird 78 1000
    alice cat 55 500
    alice cat 55 600
    alice cat 55 700
    rob dog 333 20
    rob dog 333 30


    Any suggestion is appreciated! thanks!

    Continue reading...

Compartilhe esta Página