1

My dataframe looks like this:

This is an example entry:

[
{
 "type": "bold",
 "text": "Raeesah Khan testifies to privileges committee that WP leaders told her to keep to lie made in Parliament\n\n"
},
"Ms Raeesah said that when she met the three WP leaders on Aug 8, they told her that the best thing for her to do would be to continue with the narrative that she had already given in Parliament on Aug 3. They also told her that if she and the WP could get away with it, there was no need to clarify the lie. \n\n➡️ ",
{
 "type": "link",
 "text": "https://tdy.sg/3rx9Rli"
},
"\n\n",
{
 "type": "mention",
 "text": "@todayonlinesg"
},
""
   ]

I am trying to extract the string attached to the 'text:' dictionary entry, but I am unable to do so.

Keying in:

df_new['text'] = df_new.apply(lambda x: x.text[0]['text'], axis=1)

yields:

IndexError: string index out of range

0 Answers0