def test_pie_like_px(): # Pie labels = ["Oxygen", "Hydrogen", "Carbon_Dioxide", "Nitrogen"] values = [4500, 2500, 1053, 500] fig = px.pie(names=labels, values=values) trace = go.Pie(labels=labels, values=values) _compare_figures(trace, fig) labels = ["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"] parents = ["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"] values = [10, 14, 12, 10, 2, 6, 6, 4, 4] # Sunburst fig = px.sunburst(names=labels, parents=parents, values=values) trace = go.Sunburst(labels=labels, parents=parents, values=values) _compare_figures(trace, fig) # Treemap fig = px.treemap(names=labels, parents=parents, values=values) trace = go.Treemap(labels=labels, parents=parents, values=values) _compare_figures(trace, fig) # Funnel x = ["A", "B", "C"] y = [3, 2, 1] fig = px.funnel(y=y, x=x) trace = go.Funnel(y=y, x=x) _compare_figures(trace, fig) # Funnelarea fig = px.funnel_area(values=y, names=x) trace = go.Funnelarea(values=y, labels=x) _compare_figures(trace, fig)
def test_funnel(): fig = px.funnel( x=[5, 4, 3, 3, 2, 1], y=["A", "B", "C", "A", "B", "C"], color=["0", "0", "0", "1", "1", "1"], ) assert len(fig.data) == 2
def main(): data = { 'Product Development steps': [ 'Requirement Elicitation', 'Requirement Analysis', 'Software Development', 'Debugging & Testing', 'Others' ], 'Time spent (in hours)': [50, 110, 250, 180, 70] } fig = px.funnel(data, y='Product Development steps', x='Time spent (in hours)') fig.show()
def FunnelPlot(X, labels): #DS # Generate Funnel plot for data using PlotLY module #DE #IS import plotly.express as px #IE data = dict(number=X, stage=labels) fig = px.funnel(data, x='number', y='stage') fig.show() #FE
def upload_image(request): # If image is uploaded & recieved by server if request.method == 'POST': form = imageInputForm(request.POST, request.FILES) if form.is_valid(): fileObj = request.FILES['eye_image'] fs = FileSystemStorage() filePathName = fs.save(fileObj.name, fileObj) filePathName = fs.url(filePathName) testimage = '.' + filePathName img = image.load_img(testimage, target_size=(IMG_SIZE, IMG_SIZE)) img = preprocess_image(testimage) img = np.expand_dims(img, axis=0) with graph.as_default(): probs = PredictorConfig.MLmodel.predict_proba(img) fiveProbs = [] labels = [ 'No DR', 'Mild', 'Moderate', 'Severe', 'Proliferative DR' ] for i in range(5): fiveProbs.append(probs[0, i]) label = fiveProbs.index(max(fiveProbs)) print(label) data = pd.DataFrame(zip(fiveProbs, labels), columns=['fiveProbs', 'labels']) fig = px.funnel(data, x='fiveProbs', y='labels') plt_div = plot(fig, output_type='div', include_plotlyjs=False) context = { 'filePathName': filePathName, 'filename': fileObj.name, 'plt_div': plt_div, 'label': label, } return render(request, 'predictor/pred.html', context) # If Image Upload Page Requested else: form = imageInputForm() context = {'form': form} return render(request, 'predictor/upload_image.html', context)
def set_data(): temp_list = get_data() data = temp_list[0] dict_keys = temp_list[1] pages = dict_keys[0] for i in range(4): number1 = [] number2 = [] for j in range(4): number1.append( count_clicks(data, dict_keys[0][j], dict_keys[2][0], dict_keys[1][i])) number2.append( count_clicks(data, dict_keys[0][j], dict_keys[2][1], dict_keys[1][i])) desktop = pd.DataFrame(dict(number=number1, page=pages)) desktop['device'] = 'Desktop' mobile = pd.DataFrame(dict(number=number2, page=pages)) mobile['device'] = 'Mobile' device = pd.concat([desktop, mobile], axis=0) fig = px.funnel(device, x='number', y="page", color='device') plotly.offline.plot(fig)
more_than_1000 = total_confirmed[total_confirmed.Sum > 1000].rename( columns={ "Sum": "Confirmed cases" }).sort_values(by=['Confirmed cases'], ascending=False) last_date = str(df_Death_ch['Date'].iloc[-1].date().strftime("%b %d %Y")) plt_bar(more_than_1000, 'Countries with more than 1000 COVID-19 cases as of ' + last_date, 'Country/Region', 'Confirmed cases', '#f54c4c') # All the cases around the world total_cases = total_Cases_ww + total_Cases_china total_recovered = total_Recovered_china + total_Recovered_ww total_death = total_Death_ww + total_Death_china data = dict(number=[total_cases, total_recovered, total_death], category=["Total Cases", "Total Recovered", "Deaths"]) pio.renderers.default = "browser" fig = px.funnel(data, x='number', y='category', width=2000, height=1000) fig.update_layout( title={ 'text': 'COVID-19 Statistics worldwide as of ' + last_date, 'xanchor': 'center', 'x': 0.5, 'yanchor': 'top' }, font=dict( #family="Courier New, monospace", size=22, color="#000000")) fig.show() fig.write_image(last_date + "/Worldwide totals.png")
from plotly.subplots import make_subplots import plotly.graph_objects as go total_comarision = total_comarision.sort_values('confirmed', ascending=False) total_comarision = total_comarision.sort_values('death', ascending=False) stages = total_comarision.Pandemic df_mtl = pd.DataFrame(dict(number=total_comarision.confirmed, stage=stages)) df_mtl['Category'] = 'Confirmed' df_toronto = pd.DataFrame(dict(number=total_comarision.death, stage=stages)) df_toronto['Category'] = 'Death' df = pd.concat([df_mtl, df_toronto], axis=0) fig_confirm = px.funnel(df, x='number', y='stage', color='Category', title="COVID-19 with other known epedemics") fig_confirm.show() # In[ ]: # Test performed by countryies per 1000 people testing = pd.read_csv("test.csv") testing = testing.rename(columns={'Total tests per thousand': 'TotalTest'}) testing['Date'] = pd.to_datetime(testing['Date'], errors='coerce') testing.head() # In[ ]:
def update_chart(selector_left, selector1, selector2, selector3, rdbTypeChart): # create a backup data backup_df = df if selector_left == "Explore Relationship Between Columns": # return figure for the graph based on column x , y and type of chart. if rdbTypeChart == "bar": fig = px.bar(backup_df, x=selector1, y=selector2, color='income_>50K') # set transition when updating the graph to make it display smoothy. fig.update_layout(transition_duration=500) return fig, '' if rdbTypeChart == "line": fig = px.line(backup_df, x=selector1, y=selector2, color='income_>50K') fig.update_layout(transition_duration=500) return fig, '' if rdbTypeChart == "area": fig = px.area(backup_df, x=selector1, y=selector2, color='income_>50K') fig.update_layout(transition_duration=500) return fig, '' if rdbTypeChart == "funnel": fig = px.funnel(backup_df, x=selector1, y=selector2, color='income_>50K') fig.update_layout(transition_duration=500) return fig, '' else: fig = px.scatter(backup_df, x=selector1, y=selector2, color='income_>50K') fig.update_layout(transition_duration=500) return fig, '' if selector_left == "Compare Different Between Original and Predict Data": # return figure for the graph based on column x , y and type of chart. if rdbTypeChart == "bar": fig = px.bar(d_normal, x=selector1, y=selector2, color='income_>50K') fig2 = px.bar(d_3d, x=selector1, y=selector2, color='income_>50K') # set transition when updating the graph to make it display smoothy. fig.update_layout(transition_duration=500) fig2.update_layout(transition_duration=500) return fig, fig2 if rdbTypeChart == "line": fig = px.line(d_normal, x=selector1, y=selector2, color='income_>50K') fig2 = px.line(d_3d, x=selector1, y=selector2, color='income_>50K') # set transition when updating the graph to make it display smoothy. fig.update_layout(transition_duration=500) fig2.update_layout(transition_duration=500) return fig, fig2 if rdbTypeChart == "area": fig = px.area(d_normal, x=selector1, y=selector2, color='income_>50K') fig2 = px.area(d_3d, x=selector1, y=selector2, color='income_>50K') # set transition when updating the graph to make it display smoothy. fig.update_layout(transition_duration=500) fig2.update_layout(transition_duration=500) return fig, fig2 if rdbTypeChart == "funnel": fig = px.funnel(d_normal, x=selector1, y=selector2, color='income_>50K') fig2 = px.funnel(d_3d, x=selector1, y=selector2, color='income_>50K') # set transition when updating the graph to make it display smoothy. fig.update_layout(transition_duration=500) fig2.update_layout(transition_duration=500) return fig, fig2 if rdbTypeChart == "3d": fig = px.scatter_3d(d_normal, x=selector1, y=selector2, z=selector3, color='income_>50K') fig2 = px.scatter_3d(d_3d, x=selector1, y=selector2, z=selector3, color='income_>50K') # set transition when updating the graph to make it display smoothy. fig.update_layout(transition_duration=500) fig2.update_layout(transition_duration=500) return fig, fig2 else: fig = px.scatter(d_normal, x=selector1, y=selector2, color='income_>50K') fig2 = px.scatter(d_3d, x=selector1, y=selector2, color='income_>50K') # set transition when updating the graph to make it display smoothy. fig.update_layout(transition_duration=500) fig2.update_layout(transition_duration=500) return fig, fig2 else: # return figure for the graph based on column y and type of chart. fig = px.box(backup_df, y=selector1) fig.update_layout(transition_duration=500) return fig, ''
st.header("") box_ = px.scatter(df, x='CGPA', y='LOR ', marginal_x='violin', marginal_y='box', color='Research') box_ count_p = sns.countplot(df['University Rating']) count_p st.header("Statistical analysis of the dataset") st.write(df.describe().T) fig = px.density_heatmap(df, x="University Rating", y='SOP') fig fig = px.funnel(df, x='SOP', y='LOR ', color='Research') fig bar = px.histogram(diabete, x='Pregnancies', color='Outcome', marginal='box') bar scat = px.scatter(diabete, x='SkinThickness', y='Age', color='Outcome', marginal_x='box', marginal_y='violin') scat if st.checkbox('Show columns'): st.write(diabete.columns.to_list()) if st.checkbox("Show number of classes to predict dataset"): st.write(diabete.Outcome.value_counts())
row8_1, row8_2 = st.beta_columns((.9, 1.1)) with row8_1: araclar = [] for i in filtered.index: filt = eval(filtered.analitik_araclar[i]) araclar.append(filt) araclar = list(chain.from_iterable(araclar)) araclar = pd.Series(araclar).value_counts().to_frame(name = 'İlan Sayısı').reset_index().rename(columns={'index': 'Analitik Araçlar'}) st.subheader('İş ilanlarında hangi analitik araçları bilmeniz isteniyor?') fig = px.funnel(araclar.iloc[0:10, :], x = 'İlan Sayısı', y = 'Analitik Araçlar') fig.update_layout(width=600, margin=dict(t=5) ) st.plotly_chart(fig) with row8_2: bolumler = [] for i in filtered.index: bolum = eval(filtered.istenen_bölümler[i]) bolumler.append(bolum) bolumler = list(chain.from_iterable(bolumler)) bolumler = pd.Series(bolumler).value_counts().to_frame(name = 'İlan Sayısı').reset_index().rename(columns={'index': 'Aranan Bölümler'})
def FunnelPlot(Data, labels): data = dict(number=Data, stage=labels) fig = px.funnel(data, x='number', y='stage') fig.show()
def update2(input3, input4, input5, input21): state1 = get_given_state_data(state_df, input3) state2 = get_given_state_data(state_df, input4) dfresult = state1 dfresult[input3] = state1[input5] dfresult[input4] = state2[input5] fig = None if input21 == "plot": fig = px.line( dfresult, x=get_dates(state_df), y=[input3, input4], title="Covid-19 : Cases comparison between %s and %s . " % (input3, input4), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input21 == "bar": fig = px.bar(dfresult, x=get_dates(state_df), y=[input3, input4], title="Covid-19 : Cases comparison between %s and %s . " % (input3, input4), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input21 == "histogram": fig = px.histogram( dfresult, x=get_dates(state_df), y=[input3, input4], title="Covid-19 : Cases comparison between %s and %s . " % (input3, input4), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input21 == "area": fig = px.area( dfresult, x=get_dates(state_df), y=[input3, input4], title="Covid-19 : Cases comparison between %s and %s . " % (input3, input4), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input21 == "funnel": fig = px.funnel( dfresult, x=get_dates(state_df), y=[input3, input4], title="Covid-19 : Cases comparison between %s and %s . " % (input3, input4), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input21 == "scatter": fig = px.scatter( dfresult, x=get_dates(state_df), y=[input3, input4], title="Covid-19 : Cases comparison between %s and %s . " % (input3, input4), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") fig.update_layout(font_family="Courier New", font_color="blue", title_font_family="Times New Roman", title_font_color="red", legend_title_font_color="green", transition_duration=500) return fig
funnel_by_groups = [] # for every experiment group for i in new_data.exp_id.unique(): group = new_data[new_data.exp_id == i].groupby([ 'event_name', 'exp_id' ])['user_id'].nunique().reset_index().sort_values(by='user_id', ascending=False) funnel_by_groups.append(group) # concatenate the data to have one big dataframe funnel_by_groups = pd.concat(funnel_by_groups) # display funnel fig = px.funnel(funnel_by_groups, x='user_id', y='event_name', color='exp_id') fig.show() # ## Study the results of the experiment # ### How many users are there in each group? usersExp = new_data.groupby('exp_id')['user_id'].nunique().reset_index() usersExp.columns = ['exp_id', 'unique_users'] display(usersExp) # ### In each of the control groups, find the number of users who performed each event. # create a pivot table with the number of unique users in each control gorup that goes through each action expGroups = new_data.pivot_table(index='event_name', values='user_id', columns='exp_id', aggfunc=lambda x: x.nunique()).reset_index() expGroups.columns = ['event_name', '246', '247', '248']
st.write(iris.target_names) st.subheader('Prediction') st.write(iris.target_names[prediction]) #st.write(prediction) st.subheader('Prediction Probability') st.write(prediction_proba) import plotly.express as px data = dict(number=[39, 24, 21, 14, 2], stage=[ "Visit", "Downloads", "Potential customers", "Requested price", "Invoice sent" ]) fig = px.funnel(data, x='number', y='stage', width=600, height=400) #st.fig.show() #st.plotly st.plotly_chart(fig) import plotly.express as px #import pandas as pd stages = [ "Visit", "Downloads", "Potential customers", "Requested price", "Invoice sent" ] df_mtl = pd.DataFrame( dict(number=[39, 24, 21, 14, 2], stage=[ 'Visit', "Downloads", "Potential customers", "Requested price", "Invoice sent"
''' 18-01-2020 Shukrithi Rathna Assignment 2 Q8. Generating Funnel Plot ''' import plotly.express as px data = dict(number=[50, 110, 250, 180, 70], stage=[ "Requirement Elicitation", "Requirement Anlaysis", "Software Development", "Debugging and Testing", "Others" ]) fig = px.funnel(data, x='number', y='stage') fig.show()
connector = {"mode":"between", "line":{"width":4, "color":"rgb(0, 0, 0)", "dash":"solid"}} )) fig.update_layout(title = "Profit and loss statement 2018") fig.show() # In[ ]: import plotly.express as px data = dict( number=[39, 27.4, 20.6, 11, 2], stage=["Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"]) fig = px.funnel(data, x='number', y='stage') fig.show() # In[ ]: import plotly.express as px import pandas as pd stages = ["Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"] df_mtl = pd.DataFrame(dict(number=[39, 27.4, 20.6, 11, 3], stage=stages)) df_mtl['office'] = 'Montreal' df_toronto = pd.DataFrame(dict(number=[52, 36, 18, 14, 5], stage=stages)) df_toronto['office'] = 'Toronto' df = pd.concat([df_mtl, df_toronto], axis=0) fig = px.funnel(df, x='number', y='stage', color='office')
# 8th Question: # $ pip install plotly==4.4.1 import plotly.express as px import matplotlib.pyplot as plt steps = [ 'Requirement Elicitation', 'Requirement Analysis', 'Software Development', 'Debugging & Testing', 'Others' ] TimeSpend = [50, 110, 250, 180, 70] data = {'Product Development steps': steps, 'Time spent': TimeSpend} fig = px.funnel(data, x='Time spent', y='Product Development steps') fig.show() plt.show()
country_count = pd.DataFrame(country_count) top_country = country_count[0:10] top_country # In[27]: # Funnel chart using plotly import plotly.express as px data = dict(number=[1063, 619, 135, 60, 47, 44, 41, 40, 40, 38], country=[ "United States", "India", "United Kingdom", "Canada", "UK,US", "Spain", "Turkey", "Philippines", "France", "South Korea" ]) fig = px.funnel(data, x='number', y='country') fig.show() # # TV shows with Largest Number of Seasons # In[39]: features = ['title', 'duration'] durations = netflix_Tv_shows[features] durations['no_of_season'] = durations['duration'].str.replace('Season', '') durations['no_of_season'] = durations['no_of_season'].str.replace('s', '') durations['no_of_season'] = durations['no_of_season'].astype(str).astype(int) top = ['title', 'no_of_season'] top_ = durations[top] top_ = top_.sort_values(by='no_of_season', ascending=False) top20 = top_[0:20]
import plotly.express as px fig = px.funnel(y=[ "завтрак", "перекус1", "обед", "перекус2", "ужин", "завтрак", "перекус1", "обед", "перекус2", "ужин", "завтрак", "перекус1", "обед", "перекус2", "ужин", "завтрак", "перекус1", "обед", "перекус2", "ужин" ], x=[ 15, 10, 25.4, 10, 26, 9.8, 15, 36.2, 9.6, 7.6, 1.9, 4, 7.1, 1.6, 1.97, 3, 0.5, 11.7, 3, 2 ], color=[ "белок", "белок", "белок", "белок", "белок", "углеводы", "углеводы", "углеводы", "углеводы", "углеводы", "жир", "жир", "жир", "жир", "жир", "пищевые волокна", "пищевые волокна", "пищевые волокна", "пищевые волокна", "пищевые волокна" ]) fig.show()
def update_figure(sta1, input2): fig = None state = get_given_state_data(state_df, sta1) if input2 == 'plot': fig = px.line(state, x=get_dates(state_df), y=['Confirmed', 'Active', 'Recovered', 'Deceased'], title="Covid-19 data of state.", labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input2 == 'bar': fig = px.bar(state, x=get_dates(state_df), y=['Confirmed', 'Active', 'Recovered', 'Deceased'], title="Covid-19 data of state.", labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input2 == 'area': fig = px.area(state, x=get_dates(state_df), y=['Confirmed', 'Active', 'Recovered', 'Deceased'], title="Covid-19 data of state.", labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input2 == 'histogram': fig = px.histogram(state, x=get_dates(state_df), y=['Confirmed', 'Active', 'Recovered', 'Deceased'], title="Covid-19 data of state.", labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input2 == 'funnel': fig = px.funnel(state, x=get_dates(state_df), y=['Confirmed', 'Active', 'Recovered', 'Deceased'], title="Covid-19 data of state.", labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input2 == 'scatter': fig = px.scatter(state, x=get_dates(state_df), y=['Confirmed', 'Active', 'Recovered', 'Deceased'], title="Covid-19 data of state.", labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") fig.update_layout(font_family="Courier New", font_color="blue", title_font_family="Times New Roman", title_font_color="red", legend_title_font_color="green", transition_duration=500) return fig
import dash from dash import dcc from dash import html import plotly.express as px app = dash.Dash(__name__) # Connect to Materialize as a regular database conn = psycopg2.connect("dbname=materialize user=materialize port=6875 host=localhost") # Read the materialized view with Pandas sql = "select * from consolidated_funnel order by cnt desc;" df = pd.read_sql_query(sql, conn) # Plot a funnel chart fig = px.funnel(df, x="step", y="cnt") # Main UI scaffolding for the dashboard app.layout = html.Div(children=[ html.H1(children='Conversion Funnel'), html.Div(children=''' Dash: A web application framework for your data. '''), dcc.Graph( id='funnel-chart', figure=fig ) ])
def update3(input6, input7, input8, input31): city1 = get_given_city_data(city_df, input6) city2 = get_given_city_data(city_df, input7) dfresult = city1 dfresult[input6] = city1[input8] dfresult[input7] = city2[input8] fig = None if input31 == 'plot': fig = px.line( dfresult, x=get_dates(city_df), y=[input6, input7], title="Covid-19 : Cases comparison between %s and %s . " % (input6, input7), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input31 == 'bar': fig = px.bar(dfresult, x=get_dates(city_df), y=[input6, input7], title="Covid-19 : Cases comparison between %s and %s . " % (input6, input7), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input31 == 'histogram': fig = px.histogram( dfresult, x=get_dates(city_df), y=[input6, input7], title="Covid-19 : Cases comparison between %s and %s . " % (input6, input7), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input31 == 'area': fig = px.area( dfresult, x=get_dates(city_df), y=[input6, input7], title="Covid-19 : Cases comparison between %s and %s . " % (input6, input7), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input31 == 'funnel': fig = px.funnel( dfresult, x=get_dates(city_df), y=[input6, input7], title="Covid-19 : Cases comparison between %s and %s . " % (input6, input7), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") if input31 == 'scatter': fig = px.scatter( dfresult, x=get_dates(city_df), y=[input6, input7], title="Covid-19 : Cases comparison between %s and %s . " % (input6, input7), labels={ "x": "Time", "value": "Number of Cases" }, template="presentation") fig.update_layout(font_family="Courier New", font_color="blue", title_font_family="Times New Roman", title_font_color="red", legend_title_font_color="green", transition_duration=500) return fig
import plotly.express as px import pandas as pd stages = ["访问数", "下载数", "注册数", "搜索数", "付款数"] data = dict(number=[59, 32, 18, 9, 2], stage=stages) px.funnel(data, x="number", y="stage").show() df_male = pd.DataFrame( dict(number=[59, 32, 18, 9, 2], stage=stages, gender=["男"] * 5)) df_female = pd.DataFrame( dict(number=[29, 17, 8, 3, 1], stage=stages, gender=["女"] * 5)) px.funnel(pd.concat([df_male, df_female]), x="number", y="stage", color="gender").show()
import plotly.express as px fig = px.sunburst( names=[ "Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura" ], parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"], values=[10, 14, 12, 10, 2, 6, 6, 4, 4], ) fig.write_html(os.path.join(dir_name, "sunburst.html"), auto_play=False) import plotly.express as px fig = px.funnel(y=["first", "second", "first", "second"], x=[3, 1, 4, 2], color=["A", "A", "B", "B"]) fig.write_html(os.path.join(dir_name, "funnel.html"), auto_play=False) import plotly.express as px fig = px.scatter(x=[1, 2, 1, 2], y=[4, 3, 2, 4], color=[True, True, False, False]) fig.write_html(os.path.join(dir_name, "scatter_bool_color.html"), auto_play=False) import plotly.express as px fig = px.pie(values=[1, 2, 3, 4], color=[True, False, True, False]) fig.write_html(os.path.join(dir_name, "pie_bool_color.html"), auto_play=False)
Например, он используется для наблюдения за доходом или убытком в процессе продаж для каждого этапа и отображает значения, которые постепенно уменьшаются. Каждый этап иллюстрируется как процент от общего числа всех значений. """ import plotly.express as px import plotly.graph_objects as go import pandas as pd # 1) Basic Funnel Plot with plotly.express data = dict(number=[39, 27.4, 20.6, 11, 2], stage=[ "Посещения сайта", "Загрузки", "Потенциальные клиенты", "Запрос о цене", "Выставлен счёт" ]) fig = px.funnel(data, x='number', y='stage', title='Основная воронка продаж') fig.show() # 2) Stacked Funnel Plot with plotly.express stages = [ "Посещения сайта", "Загрузки", "Потенциальные клиенты", "Запрос о цене", "Выставлен счёт" ] df_mtl = pd.DataFrame(dict(number=[39, 27.4, 20.6, 11, 3], stage=stages)) df_mtl['office'] = 'Санкт-Перербург' df_toronto = pd.DataFrame(dict(number=[52, 36, 18, 14, 5], stage=stages)) df_toronto['office'] = 'Москва' df = pd.concat([df_mtl, df_toronto], axis=0) fig = px.funnel(df, x='number', y='stage',