【发布时间】:2020-08-30 08:25:48
【问题描述】:
这是一个由 ID 和 ColumnA 组成的 2 行的原始数据框。某行可能只有一个细节。
ID ColumnA
1 {'1': {'Order': '0', 'Result': ''},
'2': {'Order': 'Yellow', 'Result': 'Red'},
'3': {'Order': 'Clear', 'Result': 'Tight'},
'4': {'Order': '1.000-1.030', 'Result': '1.015'}}
2 {'1': {'Order': '0', 'Result': '1.015'},
'4': {'Order': '1.000-1.030', 'Result': '2.4'},
'5': {'Order': '6.0-7.0', 'Result': ''},
'6': {'Order': 'Negative', 'Result': 'Negative'},
'7': {'Order': 'Negative', 'Result': 'Negative'},
'8': {'Order': 'Negative', 'Result': 'Positive'},
'9': {'Order': 'Negative', 'Result': ''}}
我想从 ColumnA 提取到新的数据框
ID Column_ID Column_Order ColumnD_Result
1 1 0
1 2 Yellow Red
1 3 Clear Tight
1 4 1.000-1.030 1.015
2 1 0 1.015
2 4 1.000-1.030 2.4
2 5 6.0-7.0
2 6 Negative Negative
2 7 Negative Negative
2 8 Negative Positive
2 9 Negative
提取字典怎么写?
【问题讨论】:
-
你能显示你的代码吗?如果您包含您的方法并解释为什么不起作用,您更有可能获得高质量的答案
标签: python pandas dataframe dictionary