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})
感謝