[
{"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 如何实现这种复杂的表格排列
Ceci peut être réalisé en utilisant pandas groupby, le code est pour votre référence
Organisez d'abord les cellules dans l'ordre, puis fusionnez les cellules.
Vous avez besoin d'une bibliothèque pour faire fonctionner Excel, telle que :
openpyxl
.Vérifiez ensuite comment remplir les données dans cette bibliothèque et comment fusionner des cellules.
http://openpyxl.readthedocs.i...