#範例4-11:讀取score.csv建立dataFrame,然後用express印出四位學生的三科成績 # https://acupun.site/lecture/python_data/example/chp4/score2.csv import pandas as pd import plotly.express as px # dataFrame = pandas 讀入csv檔案 df = pd.read_csv('https://acupun.site/lecture/python_data/example/chp4/score2.csv') #設定空白 figure fig = px.line() #加上三條線(設定x=欄位,y=欄位,name=legend標例名稱,showlegend=True) fig.add_bar(x=df['姓名'], y=df['國文'],name='國文', showlegend = True) fig.add_scatter(x=df['姓名'], y=df['英文'],name='英文', showlegend = True) fig.add_scatter(x=df['姓名'], y=df['數學'],name='數學', showlegend = True) #fig.show() fig.write_html('exp4-11.html',auto_open=True)