Zbehel commited on
Commit
18e291f
·
1 Parent(s): b3f8976

Debugging

Browse files
Files changed (1) hide show
  1. app.py +34 -45
app.py CHANGED
@@ -11,64 +11,53 @@ df.rename(columns={'delay_at_checkout_in_minutes': 'delay'}, inplace=True)
11
 
12
  df['late_checkin'] = df['delay'] > 0
13
 
14
- # Créer des onglets
15
- tab1, tab2 = st.tabs(["Getaround Rentals Analysis", "MLflow Dashboard"])
16
 
17
- with tab1:
18
- # Titre du tableau de bord
19
- st.title("Getaround Rentals Analysis")
20
 
21
- # Description
22
- st.markdown("""
23
- In order to mitigate those issues we’ve decided to implement a minimum delay between two rentals. A car won’t be displayed in the search results if the requested checkin or checkout times are too close from an already booked rental.
24
 
25
- It solves the late checkout issue but also potentially hurts Getaround/owners revenues: we need to find the right trade off.
26
 
27
- Our Product Manager still needs to decide:
 
28
 
29
- - threshold: how long should the minimum delay be?
30
- - scope: should we enable the feature for all cars?, only Connect cars?
31
 
32
- In order to help them make the right decision, they are asking you for some data insights. Here are the first analyses they could think of, to kickstart the discussion. Don’t hesitate to perform additional analysis that you find relevant.
33
- """)
34
 
35
- # Visualiser les données
36
- fig = px.histogram(df, x='delta', title='Distribution of Delays Between Rentals')
37
- st.plotly_chart(fig)
38
 
39
- # Sélection du seuil et du scope
40
- threshold = st.slider("Select the minimum delay threshold (in hours)", 0, 12, 2)
41
- scope = st.selectbox("Select the scope", ["All cars", "Connect cars"])
42
 
43
- # Filtrer les données en fonction du scope
44
- if scope == "Connect cars":
45
- df = df[df['car_type'] == 'Connect']
46
 
47
- # Calculer le pourcentage de réservations affectées
48
- affected_rentals = df[df['delta'] < threshold].shape[0]
49
- total_rentals = df.shape[0]
50
- share_affected_rentals = affected_rentals / total_rentals * 100
51
 
52
- # Afficher les résultats
53
- st.write(f"Percentage of rentals potentially affected by the feature: {share_affected_rentals:.2f}%")
54
 
55
- # Analyser les retards
56
- late_checkins = df[df['late_checkin'] == True].shape[0]
57
- total_checkins = df.shape[0]
58
- share_late_checkins = late_checkins / total_checkins * 100
59
 
60
- st.write(f"Share of late check-ins: {share_late_checkins:.2f}%")
61
 
62
- # # Visualiser les données
63
- # fig = px.histogram(df, x='delta', title='Distribution of Delays Between Rentals')
64
- # st.plotly_chart(fig)
65
 
66
- # Analyser les cas problématiques résolus
67
- solved_cases = df[(df['delta'] < threshold) & (df['late_checkin'] == True)].shape[0]
68
- st.write(f"Number of problematic cases solved by the feature: {solved_cases}")
69
 
70
- with tab2:
71
- st.title("MLflow Dashboard")
72
- st.markdown("""
73
- <iframe src="http://0.0.0.0:5000" width="100%" height="800"></iframe>
74
- """, unsafe_allow_html=True)
 
11
 
12
  df['late_checkin'] = df['delay'] > 0
13
 
14
+ # Titre du tableau de bord
15
+ st.title("Getaround Rentals Analysis")
16
 
17
+ # Description
18
+ st.markdown("""
19
+ In order to mitigate those issues we’ve decided to implement a minimum delay between two rentals. A car won’t be displayed in the search results if the requested checkin or checkout times are too close from an already booked rental.
20
 
21
+ It solves the late checkout issue but also potentially hurts Getaround/owners revenues: we need to find the right trade off.
 
 
22
 
23
+ Our Product Manager still needs to decide:
24
 
25
+ - threshold: how long should the minimum delay be?
26
+ - scope: should we enable the feature for all cars?, only Connect cars?
27
 
28
+ In order to help them make the right decision, they are asking you for some data insights. Here are the first analyses they could think of, to kickstart the discussion. Don’t hesitate to perform additional analysis that you find relevant.
29
+ """)
30
 
 
 
31
 
32
+ # Visualiser les données
33
+ fig = px.histogram(df, x='delta', title='Distribution of Delays Between Rentals')
34
+ st.plotly_chart(fig)
35
 
36
+ # Sélection du seuil et du scope
37
+ threshold = st.slider("Select the minimum delay threshold (in hours)", 0, 12, 2)
38
+ scope = st.selectbox("Select the scope", ["All cars", "Connect cars"])
39
 
40
+ # Filtrer les données en fonction du scope
41
+ if scope == "Connect cars":
42
+ df = df[df['checkin_type'] == 'connect']
43
 
44
+ # Calculer le pourcentage de réservations affectées
45
+ affected_rentals = df[df['delay'] <= threshold*60].shape[0]
46
+ total_rentals = df.shape[0]
47
+ share_affected_rentals = affected_rentals / total_rentals * 100
48
 
49
+ # Afficher les résultats
50
+ st.write(f"Percentage of rentals potentially affected by the feature: {share_affected_rentals:.2f}%")
51
 
52
+ # Analyser les retards
53
+ late_checkins = df[df['late_checkin'] == True].shape[0]
54
+ total_checkins = df.shape[0]
55
+ share_late_checkins = late_checkins / total_checkins * 100
56
 
57
+ st.write(f"Share of late check-ins: {share_late_checkins:.2f}%")
58
 
 
 
 
59
 
 
 
 
60
 
61
+ # Analyser les cas problématiques résolus
62
+ solved_cases = df[(df['delta'] < threshold*60) & (df['late_checkin'] == True)].shape[0]
63
+ st.write(f"Number of problematic cases solved by the feature: {solved_cases}")