[Python] How to separate a paragraph of conversation between agent and consumer, based on...

Discussão em 'Python' iniciado por Stack, Junho 3, 2025.

  1. Stack

    Stack Membro Participativo

    In my data, two columns of data

    1. column1-"message content": example - "Hello, can I order checks from the app?, Thank you for your message! can you tell me your id and password?, Sure my name is Tom Smith and my password is xxxx, Ok I will send the checks to your address please confirm your address, yes my address is '123 main st'"

    2)column2-"message sent by": example -"Consumer, Agent, Consumer, Agent, Consumer"

    The Goal is to create two new columns: column1 - words by Consumer: "Hello, can I order checks from the app?, Sure my name is Tom Smith and my password is xxxx, yes my address is '123 main st'"

    Column2 - words by Agent: " Thank you for your message! can you tell me your id and password?, Ok I will send the checks to your address please confirm your address,"

    Is there any easy way to accomplish this purpose?

    I try to use list of separate, but no good

    Continue reading...

Compartilhe esta Página