I have a pandas dataframe where one column has the values in the form of : [{'reaction':…
- User
I have a pandas dataframe where one column has the values in the form of : [{'reaction': '😮', 'actor': 'Hamzah Raza'}]. What is the cleanest and most efficient way to make that column into two (one for reaction and one for actor)
Assistant
You can use the
apply()function along with a lambda function to extract the values and create new columns in the dataframe. Here's an example:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.