我在mysql db列中有这种类型的json,我想使用python读取并转换为CSV。
{"type":["11","27","26","6"],
"comment":["","","","ADVANCE"],
"remark":["","","","anything"],
"unit":["1.00","1.00","1.00","5000"],
"rate":["1300000","1409.37","100","1"],
"extra":["1.00","850","850","1"],
"amount":["1300000.00","1197964.50","85000.00","5000.00"]}
字符串
我需要像这样的最终输出:
"type","comment","remark","unit","rate","extra","amount"
"11","","","1.00","1300000","1.00","1300000.00"
"27","","","1.00","1409.37","850","1197964.50"
"26","","","1.00","100","850","85000.00"
"6","ADVANCE","anything","5000","1","1","5000.00"
型
1条答案
按热度按时间e4yzc0pl1#
好吧,通过使用pandas和json模块,我们可能有一个解决方案。这是从原始数据到csv文件的代码:
字符串
输出量:
型
希望对你有帮助。如果不是你想要的,请给予更多的信息或上下文。美好的一天