I am trying to split the object lists starting with C - :\t & A - :\t strings in the dataframe cell into two separate column with the sentences or dialogue for A and another column for C. I need to remain in a pandas dataframe as each cell has a unique key that links to other data. I have managed to find examples with lists but my data is in a pandas dataframe, and I don't seem to be able to get it to work. I am hoping this community can help me in someway.
df_txt['dialogue_sentences']**[10]** = ['',
'C - :\t hello',
'A - :\t good morning can i speak to you nox',
'C - :\t hello',
'A - :\t hy sien',
'C - :\t hawu',
'A - :\t ok',
'C - :\t yebo ngimi',
"A - :\t hello good morning i am thomas we're calling you from a financial services how are you",
'C - :\t ngiyaphila',
"A - :\t great to know you Nox we're calling you today in relation to your vehicle the mechanic warranty has been expired i'm sure you are aware of this year",
'C - :\t no',
"A - :\t it's a mechanical plan on the ford",
'C - :\t hayi so i sold it',
"A - :\t so you don't have this car anymore the ford",
"C - :\t ja yes i don't phone it",
"A - :\t or you don't have",
'C - :\t ne',
'A - :\t any car',
'C - :\t in',
"A - :\t okay alright no problem i'll make a note for all right",
'C - :\t thank you',
'A - :\t righto sharp bye',
'']
Outcome to look like this:
df_txt['dialogue_c']**[10]** = ['hello',
'hello',
'hawu',
'yebo ngimi',
'ngiyaphila',
'no',
'hayi so i sold it',
'ja yes i don't phone it',
'ne',
'in',
'thank you']
and
df_txt['dialogue_a']**[10]** = ['good morning can i speak to you nox',
'hy sien',
'ok',
'hello good morning i am thomas we're calling you from a financial services how are you',
'great to know you Nox we're calling you today in relation to your vehicle the mechanic warranty has been expired i'm sure you are aware of this year',
'it's a mechanical plan on the ford',
'so you don't have this car anymore the ford',
'or you don't have',
'any car',
'okay alright no problem i'll make a note for all right',
'righto sharp bye']
The data arrives with no punctuation except for contractions with apostrophes. Each conversation differs in length but always alternates between C - :\t & A - :\t sentences or dialogue.