table_a = pd.DataFrame(data=[ [ children_mean, adults_32_mean, adults_48_mean, adults_66_mean, adults_plus_mean ], [ childrenRev_mean, youngRev_32_mean, adultsRev_48_mean, adultsRev_66_mean, adultsRev_plus_mean ], [ children_rating, adults_32_rating, adults_48_rating, adults_66_rating, adults_plus_rating ], [ children_nights, adults_32_nights, adults_48_nights, adults_66_nights, adults_plus_nights ], [children_wd, adults_32_wd, adults_48_wd, adults_66_wd, adults_plus_wd], [children_we, adults_32_we, adults_48_we, adults_66_we, adults_plus_we], [ children_nation_rev, adults_32_nation_rev, adults_48_nation_rev, adults_66_nation_rev, adults_plus_nation_rev ], [ children_nation_rating, adults_32_nation_rating, adults_48_nation_rating, adults_66_nation_rating, adults_plus_nation_rating ], [ children_nation_upselling, adults_32_nation_upselling, adults_48_nation_upselling, adults_66_nation_upselling, adults_plus_nation_upselling ] ], index=index_age, columns=columns_age)
table_m_s = pd.DataFrame(data=[ [ Solo_Travellers_mean, Family_mean, Groups_mean, Couples_mean, Business_mean ], [ Solo_TravellersRev_mean, FamilyRev_mean, GroupsRev_mean, CouplesRev_mean, BusinessRev_mean ], [ Solo_Travellers_rating, Family_rating, Groups_rating, Couples_rating, Business_rating ], [ Solo_Travellers_nights, Family_nights, Groups_nights, Couples_nights, Business_nights ], [Solo_Travellers_wd, Family_wd, Groups_wd, Couples_wd, Business_wd], [Solo_Travellers_we, Family_we, Groups_we, Couples_we, Business_we], [ Solo_Travellers_nation_rev, Family_nation_rev, Groups_nation_rev, Couples_nation_rev, Business_nation_rev ], [ Solo_Travellers_nation_rating, Family_nation_rating, Groups_nation_rating, Couples_nation_rating, Business_nation_rating ], [ Solo_Travellers_nation_upselling, Family_nation_upselling, Groups_nation_upselling, Couples_nation_upselling, Business_nation_upselling ] ], index=index_mss, columns=columns_mss)
import plotly.graph_objs as go from settings import hotel_data, pd """ CHOROPLETH VALUES """ values_choro = pd.DataFrame( hotel_data.groupby('Country')[['ADR Adjusted', 'Customer Satisfaction Rating']].mean()).reset_index().copy() values_choro_count = pd.DataFrame( hotel_data.groupby('Country')[['ADR Adjusted']].count()).reset_index().copy() values_choro_sum = pd.DataFrame( hotel_data.groupby('Country')[['ADR Adjusted']].sum()).reset_index().copy() values_choro['N° Clients (count)'] = values_choro_count['ADR Adjusted'] values_choro['ADR Adjusted (total sum)'] = values_choro_sum['ADR Adjusted'] values_choro.rename(columns={'ADR Adjusted': 'ADR Adjusted (mean)', 'Customer Satisfaction Rating': 'Customer Satisfaction Rating (mean)'}, inplace=True) data_map_revenues = [go.Choropleth( locations=values_choro['Country'], z=values_choro['ADR Adjusted (mean)'], locationmode="country names", showscale=False, colorscale=[ [0, "rgb(5, 10, 172)"], [0.35, "rgb(40, 60, 190)"], [0.5, "rgb(70, 100, 245)"], [0.6, "rgb(90, 120, 245)"], [0.7, "rgb(106, 137, 247)"], [1, "rgb(220, 220, 220)"] ],
'Upselling mean', 'Revenues mean', 'Rating mean', 'Length staying mean (days)', ' - N° Weekdays', ' - N° Weekend days', 'Nationality highest revenues', 'Nationality highest rating', 'Nationality highest upselling' ] table_dc = pd.DataFrame(data=[ [TATO_mean, direct_mean, corporate_mean, gds_mean], [TATORev_mean, directRev_mean, corporateRev_mean, gdsRev_mean], [TATO_rating, direct_rating, corporate_rating, gds_rating], [TATO_nights, direct_nights, corporate_nights, gds_nights], [TATO_wd, direct_wd, corporate_wd, gds_wd], [TATO_we, direct_we, corporate_we, gds_we], [TATO_nation_rev, direct_nation_rev, corporate_nation_rev, gds_nation_rev], [ TATO_nation_rating, direct_nation_rating, corporate_nation_rating, gds_nation_rating ], [ TATO_nation_upselling, direct_nation_upselling, corporate_nation_upselling, gds_nation_upselling ] ], index=index_dc, columns=columns_dc) table_dchannel = table_dc.reset_index() table_dchannel1 = go.Table( domain=dict(x=[0, 1], y=[0, 0.80]), columnwidth=[2, 1, 1, 1],
columns_ct = ['Transient', 'Transient-Party', 'Contract', 'Group'] index_ct = index_age table_ct = pd.DataFrame(data=[ [transient_mean, transient_party_mean, contract_mean, group_mean], [ transientRev_mean, transient_partyRev_mean, contractRev_mean, groupRev_mean ], [transient_rating, transient_party_rating, contract_rating, group_rating], [transient_nights, transient_party_nights, contract_nights, group_nights], [transient_wd, transient_party_wd, contract_wd, group_wd], [transient_we, transient_party_we, contract_we, group_we], [ transient_nation_rev, transient_party_nation_rev, contract_nation_rev, group_nation_rev ], [ transient_nation_rating, transient_party_nation_rating, contract_nation_rating, group_nation_rating ], [ transient_nation_upselling, transient_party_nation_upselling, contract_nation_upselling, group_nation_upselling ] ], index=index_ct, columns=columns_ct) table_customer_type = table_ct.reset_index()