1

I have a list with this format

[{'label': 'Negative', 'score': 0.640342652797699},
{'label': 'Neutral', 'score': 0.6779775619506836},
{'label': 'Positive', 'score': 0.6488891839981079},
{'label': 'Negative', 'score': 0.8951766490936279},
{'label': 'Neutral', 'score': 0.5843858122825623},
{'label': 'Negative', 'score': 0.9183987379074097},
{'label': 'Neutral', 'score': 0.6507250666618347}]

I would like to create a data frame with this information, whit a column called sentiment and the other one called score

dataframe:

sentiment  *   score
*********************
Negative   *  0.640342652797699
Neutral    *  0.6779775619506836
Positive   *  0.6488891839981079
 ....           ....

I am not suure how can I transform my list to a data frama with this structure

2

1 Answer 1

1

you can create DataFrame then rename column name like below:

>>> pd.DataFrame(lst_dct).rename({'label': 'sentiment'}, axis=1)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.