[
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色1","数量":"1",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色2","数量":"20",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色3","数量":"3",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色4","数量":"4",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色5","数量":"5",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色6","数量":"6",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色7","数量":"30",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色8","数量":"8",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色9","数量":"9",},
{"ID":"1","订单号":"123456","用户名":"路人甲","产品":"XX用品","颜色":"色10","数量":"40",},
{"ID":"2","订单号":"456789","用户名":"路人乙","产品":"XXX用品","颜色":"红色","数量":"100",},
{"ID":"3","订单号":"123456789","用户名":"路人丙","产品":"XXXX用品","颜色":"金色","数量":"300",},
{"ID":"3","订单号":"987654321","用户名":"路人丙","产品":"XXXX用品","颜色":"紫色","数量":"100",},
]
需要转换表格为:
python3 如何实现这种复杂的表格排列
これはpandas groupbyを使用して可能です。コードは参考用です
リーリーまずセルを順番に並べてから、セルを結合します。
Excel を操作するには、次のようなライブラリが必要です。
次に、このライブラリにデータを入力する方法とセルを結合する方法を確認します。openpyxl