Algorithm · Google · Medium
Given an orders pandas DataFrame with columns order_id, user_id, amount, country, signup_date, last_review_rating, and returns, write vectorized pandas code that returns the DataFrame with an additional derived column named risk_tier. Assign risk_tier by applying the following rules in the exact order shown. Stop at the first rule that matches a row; once a row is assigned, later rules must not override it: 'high' if returns >= 2 or last_review_rating = 200 and country is…
Checking your access…