My dataset has following features: "description", "word_count", "char_count", "stopwords". The feature "description" has datatype as string which contains some text. I am doing IBM tone_analysis on this feature which gives me correct output and looks like this:
[{'document_tone': {'tones': [{'score': 0.677676,
'tone_id': 'analytical',
'tone_name': 'Analytical'}]}},
{'document_tone': {'tones': [{'score': 0.620279,
'tone_id': 'analytical',
'tone_name': 'Analytical'}]}},
The code for above is given as below:
result =[]
for i in new_df['description']:
tone_analysis = ta.tone(
{'text': i},
# 'application/json'
).get_result()
result.append(tone_analysis)
I need to keep the above output in pandas data frame.
Use lambda function in
Series.apply
:EDIT:
If need also remove
description
column: