-3

I have a Pandas dataframe where cells in one column typically look like this:

[{'source_name': 'mitre-attack', 'external_id': 'T1156', 'url': 'https://attack.mitre.org/techniques/T1156'}, {'url': 'https://researchcenter.paloaltonetworks.com/2017/04/unit42-new-iotlinux-malware-targets-dvrs-forms-botnet/', 'description': 'Claud Xiao, Cong Zheng, Yanhui Jia. (2017, April 6). New IoT/Linux Malware Targets DVRs, Forms Botnet. Retrieved February 19, 2018.', 'source_name': 'amnesia malware'}]

How do I extract (in this example) the value 'T1156' of the key 'external_id' into a new column called t_id?

Wasif
  • 14,755
  • 3
  • 14
  • 34

1 Answers1

1

It's easy, try like this:

df['t_id'] = df['external_id']
Wasif
  • 14,755
  • 3
  • 14
  • 34