0
我想在網頁上顯示pandas df.plot.bar()的結果。我該怎麼做? 這就是我想要的。如何使用Django在網頁上顯示data_frame.plot.bar()的結果?
def graph(request):
fig = Figure()
ax = fig.add_subplot(111)
data_df = pd.read_csv("C:/Users/yadynesh/Final_Project/original.csv")
data_df = pd.DataFrame(data_df)
data_df.plot.bar(ax=ax)
canvas = FigureCanvas(fig)
response = HttpResponse(content_type = 'image/png')
canvas.print_png(response)
return response