import pandas as pd
import plotly.offline as py
import plotly.graph_objs as go
def chart():
excelFile = r'test.xlsx'
df_excel = pd.DataFrame(pd.read_excel(excelFile, orient='index')).sort_index()
print (df_excel)
data = []
trace = go.Scatter(
x=df_excel['百分比'],
y=df_excel['值']
)
data.append(trace)
layout = go.Layout(
xaxis={'title': '百分比'},
yaxis={'title': '值'}
)
fig = go.Figure(data=data, layout=layout)
py.plot(fig, filename='./test.html', auto_open=False)
chart()