<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('https://raw.githubusercontent.com/ChanceDurr/MyUberEats/master/uber_hist.csv')

# Replace all of the NaN's with 0's
df = df.fillna(0)

# Add a column for the total without the tip
df['total_no_tip'] = df['total'] - df['tips']

# Delete rows with no information
df = df.drop(range(49, 62))

# Chance the timestamp to datetime format
df['timestamp_pickup'] = pd.to_datetime(df['timestamp_pickup'])
num_deliveries = df.shape[0] - 1
print(f'Number of deliveries: {num_deliveries}')

earliest_delivery = df['timestamp_pickup'].min()
print(f'Earliest Delivery: {earliest_delivery}')

latest_delivery = df['timestamp_pickup'].max()
print(f'Latest Delivery: {latest_delivery}')

mean_duration = df['duration_min'].mean()
print(f'Mean Duration(min): {mean_duration}')
 
mean_total_no_tip = df['total_no_tip'].mean()
print(f'Mean Total no Tip: {mean_total_no_tip}')
# Create a subset for deliveries less than 20 minutes
df_shorttrips = df[df['duration_min'] < 20]

# Create a subset for deliveries more than 20 minutes
df_longtrips = df[df['duration_min'] >= 20]
# Get some basic stats on the short trip subset
short_trip_max_total = df_shorttrips['total_no_tip'].max()
short_trip_min_total = df_shorttrips['total_no_tip'].min()
short_trip_mean = df_shorttrips['total_no_tip'].mean()

print(f'''Short trip max total: {short_trip_max_total}
Short trip min total: {short_trip_min_total}
Short trip mean: {short_trip_mean}''')
# Get some basic stats on the long trip subset
long_trip_max_total = df_longtrips['total_no_tip'].max()
long_trip_min_total = df_longtrips['total_no_tip'].min()
long_trip_mean = df_longtrips['total_no_tip'].mean()

print(f'''Long trip max total: {long_trip_max_total}
Long trip min total: {long_trip_min_total}
Long trip mean: {long_trip_mean}''')
df.head()
fig = plt.figure(figsize=(15, 10))
ax = fig.add_subplot(221)
plt.style.use('fivethirtyeight')
ax.scatter(df['duration_min'], df['total_no_tip'], alpha=.5, color='r')
ax.set_ylabel('Total Without Tip ($)', labelpad=10)
ax.set_xlabel('Duration (min)', labelpad=10)
ax.set_xticks([0, 5, 10, 15, 20, 25, 30, 35, 40 ,45])
ax.set_yticks([0, 2, 4, 6, 8, 10, 12, 14, 16 , 18])
ax.text(s='Trip Duration vs Total without Tip', x=-2, y=20, fontsize=20, fontweight='bold', fontname='Comic Sans')
ax.text(19, 5, s='Averge Duration', rotation='vertical', fontsize=10)
ax.text(2, 8.5, s='Average Total', fontsize=10)
ax.axvline(mean_duration, linewidth=1.5)
ax.axhline(mean_total_no_tip, linewidth=1.5)
plt.show()
fig = plt.figure(figsize=(15, 10))
ax = fig.add_subplot(221)
plt.style.use('fivethirtyeight')
ax.scatter(df['day_of_week'], df['tips'], alpha=.5, color='r')
ax.set_ylabel('Number of Tips', labelpad=10)
ax.set_xlabel('Duration (min)', labelpad=10)
ax.set_yticks([0, 2, 4, 6, 8, 10, 12, 14, 16 , 18])
ax.text(s='Trip Duration vs Total without Tip', x=-2, y=20, fontsize=20, fontweight='bold', fontname='Comic Sans')
plt.show()
df.head()
day_tip = df[['day_of_week', 'tips']]
day_tip = day_tip[day_tip['tips'] > 0]
day_tip<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16182572614107885, 'fraction_numerical': 0.03606766677306096, 'mean_word_length': 7.14025974025974, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '383848', 'license': 'MIT', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1190, 'n_words': 272, 'path': 'myubereats.ipynb', 'repo_name': 'ChanceDurr/AB-Demo', 'size': '3133'}