Page_Visits_Funnel_Project / Data Science Career Path

Hello guys, i need your help. I am really confused with the step 8 of the project. I am writing the code like that:

percentage3 = len(visit_cart_checkout_purchase[visit_cart_checkout_purchase['purchase_time'].isnull()]) / len(visit_cart_checkout_purchase[~visit_cart_checkout_purchase.checkout_time.isnull()])
print(f"{percentage3 * 100}%")

The result is:

The codecademy solution instead which is very logical by the way is:

reached_checkout = all_data[~all_data.checkout_time.isnull()]

checkout_not_purchase = all_data[(all_data.purchase_time.isnull()) & (~all_data.checkout_time.isnull())]

checkout_not_purchase_percent = float(len(checkout_not_purchase)) / float(len(reached_checkout))

print("% of users who got to checkout but did not purchase:",checkout_not_purchase_percent)

% of users who got to checkout but did not purchase: 0.17147707979626486

I can not understand why my solution does not work and i do not also understand the solution of codecademy. Any hints on that guys :roll_eyes:?

I’ve got the same doubt. Why the solution used checkout_time.isnull() so if it is null there isn’t anyone reached to checkout stage, right? If there is a timestamp in this column, it means that user_id got reached at this stage. I think that it works in this way, but the result make me have the same doubt about the resolution.