Python
#35

Contingency Tables with pd.crosstab() in Pandas

Easy
Interview Question #35

Given customer survey records with `device_type` and `churn_status`, compute a normalized percentage cross-tabulation table showing churn rates by device.

Input Table: survey
3 rows preview
device_typechurn_status
iOSRetained
iOSChurned
AndroidRetained
Expected Output Structure2 rows
device_typeChurnedRetained
Android01
iOS0.50.5
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

Python 3.10 (Pandas)
Environment Ready

Click "Run & Test" to execute your Pandas code against the test assertions.

Chat with us