数据框根据另一个元素值提取元素值

时间:2021-02-07 12:19:03

标签: python dataframe

假设附加的图像是熊猫数据框中的字段值 每个字段都有另一个 ID 列,

需要的是:

所需的数据框

<头>
ID 通过 失败 中止
1 1 0 0

pass、fail 和aborted 下的值都来自'statusCount' 元素

在此处添加字段:

[
  {
    'id': 0,
    'name': 'PASS',
    'description': 'The test run has passed',
    'isFinal': True,
    'color': '#95C160',
    'isNative': True,
    'statusCount': 1,
    'statusPercent': 100.0
  },
  {
    'id': 3,
    'name': 'FAIL',
    'description': 'The test run has failed',
    'isFinal': True,
    'color': '#D45D52',
    'isNative': True,
    'statusCount': 0,
    'statusPercent': 0.0
  },
  {
    'id': 4,
    'name': 'ABORTED',
    'description': 'The test run was aborted',
    'isFinal': True,
    'color': '#111111',
    'isNative': True,
    'statusCount': 0,
    'statusPercent': 0.0
  }
]

0 个答案:

没有答案