我有一个json文件,格式如下:
<Response>
<body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Container">
<List>
<date>2015-01-01T00:00:00+02:00</date>
<price>20164.654</price>
</List>
</body>
<resultCode>0</resultCode>
<resultDescription>success</resultDescription>
</Response>
我需要的是excel表格,标签中有两列(price和date):
^{pr2}$这看起来很简单,但我不能得到正确的结果。我得到的是:
╔═══════╦══════════════════════════╦═══════════╦══════════════════╗
║ ║ body ║ resultCode║ ResultDescription║
╠═══════╬══════════════════════════╬═══════════╬══════════════════╣
║ List ║ {'price': 20164.654, ║ ║ ║
║ ║ 'date': ║ ║ ║
║ ║ '2015-01-01T00:00:00. ║ ║ ║
║ ║ 000+0200'}, ║ 0 ║ success ║
║ ║ { ... etc. ║ ║ ║
╚═══════╩══════════════════════════╩═══════════╩══════════════════╝
我用了这个简单的代码:
pandas.read_json("url").to_excel("output.xlsx")
我尝试过使用json规范化,但总是出错。在
目前没有回答
相关问题 更多 >
编程相关推荐