#例4-10:讀取蘋果股價csv檔為dataFrame,然後用express畫圖 #蘋果股價csv檔案:https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv import pandas as pd import plotly.express as px #設定dataFrame設定資料結構(使用pandas讀入csv) df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv') #用pandas畫圖,繪line線條圖 #df.plot(kind='line',title='score of students') #用plotly.express畫圖(y="AAPL.Close") fig = px.line(df, x="Date", y="AAPL.Close") #增加另外一個欄位AAPL.Low fig.add_scatter(x=df['Date'], y=df['AAPL.Low']) #fig.show() fig.write_html('exp4-10.html',auto_open=True)