2
以下是我尝试使用pandas read_excel
和to_json
函数将其转换为JSON的excel中的数据。 JSON日期的字段"Date"
为1449446400000
(不含引号)。我想知道为什么日期显示为一个大数字而不是12/7/2015
。Python Pandas read_excel和to_json日期格式错误
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图表。
下面是代码片段;
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})
感谢