简体   繁体   English

从 Python 数据字典列中提取值

[英]Extract value from Python data dictionary column

I have a DF with a column that is a dictionary:我有一个列是字典的 DF:

import pandas as pd

data = [10,{'self': 'https://elia.atlassian.net/rest/api/3/customFieldOption/10200', 'value': 'IT-Sourced Changes 2022', 'id': '10200'},30]
df = pd.DataFrame(data, columns=['Data'])

How do I create a new column that selects only one value eg 'IT-Sourced Changes 2022'?如何创建一个仅选择一个值的新列,例如“IT-Sourced Changes 2022”?

Thank you!谢谢!

df['new_col']= df['requirement_source'].str['value']

Should get the job done应该完成工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM