【发布时间】:2021-02-21 13:25:29
【问题描述】:
我有这样的清单
[9308, '127.05', [{'id': 8568, 'name': 'some product name', 'product_id': 4204, 'variation_id': 0, 'quantity': 1, 'tax_class': '', 'subtotal': '139.00', 'subtotal_tax': '0.00', 'total': '118.15', 'total_tax': '0.00', 'taxes': [], 'meta_data': [], 'sku': '', 'price': 118.15}], 9306, '98.89', [{'id': 8566, 'name': 'some product name', 'product_id': 4200, 'variation_id': 0, 'quantity': 1, 'tax_class': '', 'subtotal': '89.99', 'subtotal_tax': '0.00', 'total': '89.99', 'total_tax': '0.00', 'taxes': [], 'meta_data': [], 'sku': '', 'price': 89.99}]
我想将其转换为如下所示的数据框:
ID Total Value Product IDs
9308 127.05 4204
9306 98.89 4200
etc.
还有一些 ID 可能只有很少的产品 ID,因此列表应如下所示:
ID Total Value Product IDs
9308 127.05 4204
9308 127.05 4200
9308 127.05 5555
谁能帮助我?我是 Python 的初学者。
【问题讨论】: