Zbehel commited on
Commit ·
18e291f
1
Parent(s): b3f8976
Debugging
Browse files
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 |
-
#
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 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 |
-
|
| 26 |
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 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 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 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 |
-
|
| 71 |
-
|
| 72 |
-
|
| 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}")
|
|
|
|
|
|