再会
我整天都在做这件事。我正在尝试将小部件添加到我的 Jupyter(ipython) 笔记本上的笔记本中。下面是我的代码,它在我的脑海中是有意义的,但它没有填充任何东西。我正在尝试通过小部件控制 StatusesList 中的值列表,以便更改填充的图形。请帮忙。
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.graph_objs import *
import numpy as np
import cufflinks as cf
init_notebook_mode()
cf.go_offline()
import pandas as pd
cf.set_config_file(theme='pearl')
from __future__ import print_function
from ipywidgets import interact, interactive, fixed
import pandas as pd
import ipywidgets as widgets
from IPython.display import display
df = pd.read_excel("C:\Users\UserName\Downloads\Complaints Management.xlsx")
df_status = df[['Status', 'Member Number']].groupby('Status').count()
StatusesList = df_status.index.tolist()
GragphValueList = df_status["Member Number"].tolist()
# w = Output()
def f(x):
x = StatusesList
return x
interact(f, x = StatusesList)
fig_status = {
'data': [{'labels': x,
'values': GragphValueList,
'type': 'pie'}],
'layout': {'title': 'Complaints by status'}
}
iplot(fig_status)