Created
March 11, 2019 19:23
-
-
Save davidcomfort/f234f4463484c312cf18ecdc271f13d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Callback for the Graphs | |
@app.callback( | |
Output('paid-search', 'figure'), | |
[Input('datatable-paid-search', "selected_rows"), | |
Input('my-date-picker-range-paid-search', 'end_date')]) | |
def update_paid_search(selected_rows, end_date): | |
travel_product = [] | |
travel_product_list = df[(df['Category'] == 'Paid Search')]['Placement type'].unique().tolist() | |
for i in selected_rows: | |
travel_product.append(travel_product_list[i]) | |
# Filter by specific product | |
filtered_df = df[(df['Placement type'].isin(travel_product))].groupby(['Year', 'Week']).sum()[['Spend TY', 'Spend LY', 'Sessions - TY', 'Sessions - LY', 'Bookings - TY', 'Bookings - LY', 'Revenue - TY', 'Revenue - LY']].reset_index() | |
fig = update_graph(filtered_df, end_date) | |
return fig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment