I have a pandas dataframe with a column.
id text_col
1 Was it Accurate?: YesnnReasoning: This is a sample text
2 Was it Accurate?: YesnnReasoning: This is a sample text
3 Was it Accurate?: NonnReasoning: This is a sample text
I have to break the text_col into two columms "Was it accurate?"
and "Reasoning"
The final dataframe should look like:
id Was it Accurate? Reasoning
1 Yes This is a sample text
2 Yes This is a sample text
3 No This is a sample text
I tried splitting the text_col using “nnReasoning:” but did’nt get desired result.
df[['Was it Accurate?','Reasoning']] = df['text_col'].str.split("nnReasoning:")