Made a function to use plotly to plot multiple line plot. In this case, the code will plot all the product time series for each city. While used the function again the previous plots just disappeared. Tried to make notebook 'trusted' Also include
import kaleido
import plotly
import plotly.express as px
import plotly.io as pio
pio.renderers.default='notebook'
plotly.offline.init_notebook_mode(connected=True)
def plot_city_products(sales,cities,products):
c_list = sales[cities].unique()
for c in c_list:
print(c)
cc = sales[sales[cities]==c]
reshaped = cc.pivot(index='week', columns=products, values='values')
cols = sales[products].unique()
tt = reshaped.reset_index()
fig = px.line(tt, x="week", y=cols)
plotly.offline.plot(fig, filename="{}.html".format(c))
fig.show()
but these do not solve the problems.
If run plot_city_products(sales,cities,products)
multiple times, previous plots keep disappearing.
Just wonder if there is other ways I could give it a try?
The plots just look this, blank plots with an unhappy face.