【发布时间】:2016-04-27 11:51:01
【问题描述】:
以下是我尝试使用 pandas read_excel 和 to_json 函数将其转换为 JSON 的 Excel 数据。 JSON 日期的字段 "Date" 为 1449446400000(不带引号)。我想知道为什么日期显示为一个大数字而不是12/7/2015。
ID Date Name Lat Long Pick Success Failure Drop Amount
===========================================================================
5 12/7/2015 PSG 11.0231335 77.0016396 31 21 10 44 5192
请告诉我如何将它转换为 JSON 格式的正确日期,以便我可以用来生成一些 JavaScript 图表。
下面是代码sn-p;
def home(request):
df = pandas.read_excel('<here goes the excel path>')
json = df.to_json(orient="records")
return render(request, 'home.html', {'data':json})
谢谢
【问题讨论】:
标签: javascript python json date pandas