close
承接之前抓下來的歷史資料, 咱們今天來畫一畫K線圖
不過用的是plotly, 首先當然還是要pip install plotly
import pandas as pd
import plotly.plotly as py
import plotly.offline as pyoff
import plotly.graph_objs as go
df = pd.read_csv(r'c:\0050.tw.csv')
trace = go.Ohlc(x=df['Date'],
open=df['Open'],
high=df['High'],
low=df['Low'],
close=df['Close'])
data = [trace]
pyoff.plot(data)
plotly如果要線上畫圖, 必須要註冊一個帳號
所以我們用pyoff來離線畫圖
網路上都說畫出來的圖比較精美, 大家覺得呢?
全站熱搜
留言列表