Python
#30

Normalize Inconsistent Boolean Flags in Pandas

Easy
Interview Question #30

Given a column with dirty boolean values like `['yes', 'Y', '1', 'no', 'N', '0', None]`, normalize them into pure `True`, `False`, and `pd.NA` boolean dtypes.

Input Table: flags
3 rows preview
subscribed
YES
0
N
Expected Output Structure3 rows
clean_subscribed
true
false
false
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