Imagine driving through town and a coupon is delivered to your cell phone for a restaurant near where you are driving. Would you accept that coupon and take a short detour to the restaurant? Would you accept the coupon but use it on a subsequent trip? Would you ignore the coupon entirely? What if the coupon was for a bar instead of a restaurant? What about a coffee house? Would you accept a bar coupon with a minor passenger in the car? What about if it was just you and your partner in the car? Would weather impact the rate of acceptance? What about the time of day?
Given dataset has 12684 entries with 26 columns
Data Source: https://github.com/chagantvj/PracticalApplicationM5/blob/main/coupons.csv
Python Code: https://github.com/chagantvj/PracticalApplicationM5/blob/main/VijayChaganti_Module5_Practical_Example1.ipynb
Note: There are no errors in the code, but FutureWarning due to usage of replace=inplace option.
Total entries for each column of the data frame is 12684.
There is some data missing for Columsn car, Bar, CoffeeHouse, CarryAway, RestaurantLessThan20 and Restaurant20To50.
Column | non-null-entries |
---|---|
car | 108 (almost all entries null and can be ignored ) |
Bar | 12577 (null data is filled with the mode() of this column) |
CoffeeHouse | 12467 (null data is filled with the mode() of this column) |
CarryAway | 12533 (null data is filled with the mode() of this column) |
RestaurantLessThan20 | 12554 (null data is filled with the mode() of this column) |
Restaurant20To50 | 12495 (null data is filled with the mode() of this column) |
data['Bar'].replace('', np.nan, inplace=True)
data['CoffeeHouse'].replace('', np.nan, inplace=True)
data['CarryAway'].replace('', np.nan, inplace=True)
data['RestaurantLessThan20'].replace('', np.nan, inplace=True)
data['Restaurant20To50'].replace('', np.nan, inplace=True)
Bar_mode_value = data['Bar'].mode()[0]
CoffeeHouse_mode_value = data['CoffeeHouse'].mode()[0]
CarryAway_mode_value = data['CarryAway'].mode()[0]
RestaurantLessThan20_mode_value = data['RestaurantLessThan20'].mode()[0]
Restaurant20To50_mode_value = data['Restaurant20To50'].mode()[0]
data['Bar'].fillna(data['Bar'].mode()[0], inplace=True)
data['CoffeeHouse'].fillna(data['CoffeeHouse'].mode()[0], inplace=True)
data['CarryAway'].fillna(data['CarryAway'].mode()[0], inplace=True)
data['RestaurantLessThan20'].fillna(data['RestaurantLessThan20'].mode()[0], inplace=True)
data['Restaurant20To50'].fillna(data['Restaurant20To50'].mode()[0], inplace=True)
Total 2017 Bar Coupons are present in dataset
Total 817 Bar Coupons are Accepted which is approximately 41% as shown in below pie chart
Drivers who never whent to Bar and who went less than 3 times have accepeted coupons compared to rest who went more than 3 times per month
never -- 0 times to bar
less1 -- Not gone to Bar
1~3 -- Going to bar more than 1 and lessthan 3
4~8 -- Going to bar more than 4 and lessthan 8
gt8 -- Going to bar more than 8
Acceptance ratio is more for age group os less than 21 years compared to higher age group
Acceptance rate between drivers who go to bars more than once a month and had passengers that were not a kid and had occupations other than farming, fishing, or forestry to all others (added this last statement "to all others" for clarity)
Drivers with no kids as passengers and whose occupation is not farming, fishing and forestry has almost equal acceptance ratio compared to all other categories of occupation together and all categories of passengers except kids.
Compare the acceptance rates between those drivers who:
Cat1 - go to bars more than once a month, had passengers that were not a kid, and were not widowed
Cat2 - go to bars more than once a month and are under the age of 30
Cat3 - go to cheap restaurants more than 4 times a month and income is less than 50K
Acceptance ration by Category1 drivers who goes to bar more than once with no passenger kids and are not widow is higher compared to category3 followed by category1
Category3 who are less income drivers compared to category1 and category3 acceptance ration is less which is the obvious that they may not willingto spend on Bar and other recreations