<jupyter_start><jupyter_text>Requests status<jupyter_code>status = pd.crosstab(index = uber["Status"], columns="count")     
status.plot.bar()<jupyter_output><empty_output><jupyter_text>There are more "No cars available" than "Number of trips" cancelled.<jupyter_code>pick_point = pd.crosstab(index = uber["Pickup point"], columns="count")     
pick_point.plot.bar()<jupyter_output><empty_output><jupyter_text>Both Airport and City pickup points have approximately equal datapoints in a given dataset<jupyter_code>#grouping by Status and Pickup point.
uber.groupby(['Status', 'Pickup point']).size()
# Visualizing the count of Status and Pickup points
plt.figure(figsize=(8,5))
sns.countplot(x=uber['Pickup point'],hue =uber['Status'] ,data = uber)<jupyter_output><empty_output><jupyter_text>As seen in above visualization, there is higher incidence of No cars available status from Airport to City whereas there ishigher incidence of Cancelled status from City to Airport.  Timeslots<jupyter_code>#Request hours
uber['Request Hour'] = uber['Request timestamp'].dt.hour
uber.loc[uber['Request Hour'].between(1,11, inclusive=True),'Request Time Slot'] = 'Morning'
uber.loc[uber['Request Hour'].between(12,16, inclusive=True),'Request Time Slot'] = 'Noon'
uber.loc[uber['Request Hour'].between(17,21, inclusive=True),'Request Time Slot'] = 'Evening'
uber.loc[uber['Request Hour'].between(21,24, inclusive=True),'Request Time Slot'] = 'Night'
uber.head()
#As Demand include trips completed, cancelled and no cars available, we will create a column with value 1
uber['Demand'] = 1
#As Supply can only contain trips completed, so we will create a column with 1 for trips completed and 0 otherwise.
uber['Supply'] = 0
uber.loc[(uber['Status'] == 'Trip Completed'),'Supply'] = 1<jupyter_output><empty_output><jupyter_text>Gap between supply and demand<jupyter_code>uber['Gap'] = uber['Demand'] - uber['Supply']
uber.loc[uber['Gap']==0,'Gap'] = 'Trip Completed'
uber.loc[uber['Gap']==1,'Gap'] = 'Trip Not Completed'
uber = uber.drop(['Request Hour', 'Demand', 'Supply'], axis=1)
uber.head()
sns.countplot(x=uber['Request Time Slot'],hue =uber['Status'] ,data = uber)<jupyter_output><empty_output><jupyter_text>From the above plot it is visible that there are "Higher incidences of No cars available in the evening" and "Higher incidences of Cancelled trips in the morning "  Find the time slots when the highest gap exists<jupyter_code>plt.figure(figsize=(10,10))
pickup_df = pd.DataFrame(uber.groupby(['Pickup point','Request Time Slot', 'Status'])['Request id'].count().unstack(fill_value=0))
pickup_df.plot.bar(figsize=(8,5))<jupyter_output><empty_output><jupyter_text>As seen in visualization above,there are higher incidences of "No cars available" from Airport to City in the evenings while there are incidences of "Trips cancelled" from City to Airport in the mornings<jupyter_code>gap_main_df = pd.DataFrame(uber.groupby(['Request Time Slot','Pickup point','Gap'])['Request id'].count().unstack(fill_value=0))
gap_main_df.plot.bar(figsize=(5,5))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13951219512195123, 'fraction_numerical': 0.011707317073170732, 'mean_word_length': 7.763532763532764, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '530754', 'license': 'MIT', 'n_tokens_mistral': 1037, 'n_tokens_neox': 990, 'n_words': 270, 'path': 'UberDemandSupply.ipynb', 'repo_name': 'Jitmanyu1/IIIT-PGD-Data-Science', 'size': '3075'}