Back to problems

Transform DataFrame and compute diff-in-diff

Algorithm · Uber · Medium

Consider a table df with one row per observed unit. Its columns are: unit_id: a unit identifier. group: either 'treatment' or 'control'. period: either 'pre' or 'post'. y: the outcome, stored as text. Every non-missing value is a valid integer string, and exactly one row has a missing y. Perform these steps: Convert y to a numeric representation. Replace the missing outcome with the simple average of all non-missing converted y values. This average is computed across the…

Checking your access…