2
嗨,我從OANDA收到我的數據,並通過Django的在charts.js我如何可以重新格式化日期
class ChartData(APIView):
def get(request, *args, **kwargs):
data = oanda.get_history(instrument='EUR_USD', # our instrument
start='2016-10-01' , # start data
end=time.strftime("%Y-%m-%d"), # end date
granularity='D') # minute bars # 7
df = pd.DataFrame(data['candles']) # 8
data50 = oanda.get_history(instrument='EUR_USD', # our instrument
start='2016-10-01', # start data
end='2017-01-01', # end date
granularity='D') # minute bars # 7
df50 = pd.DataFrame(data50['candles']) # 8
data200 = oanda.get_history(instrument='EUR_USD', # our instrument
start='2016-6-01', # start data
end='2017-01-01', # end date
granularity='D') # minute bars # 7
df200 = pd.DataFrame(data200['candles']) # 8
history = df['openBid']
date_labels = df['time']
history = df['openBid']
date_labels = df['time']
data = {
"history": history,
"date_labels": date_labels,
}
return Response(data)
現在的日期格式,你可以在截圖中看到繪製。 我該如何格式化日期格式爲DD/MM/JJJJ?
在此先感謝
完美答案thx – Mars
@Mars你可以請把它標記爲接受答案,如果有幫助,謝謝:) –