Candidate telemetry diagnostic, error autopsy, and step-by-step query construction walkthrough.
Live aggregated metrics across candidate sandbox attempts
46 solved
First attempt fail
Evaluated submissions
Median time to solve
Unlocked answer
Reshape the given 1D array of 12 elements into a 3x4 matrix.
NumPy array arr with 12 elements: [1, 2, 3, ..., 12]
arr into a 3-row, 4-column 2D arrayOperating on a DataFrame slice without `.copy()`, producing `SettingWithCopyWarning`, or using `.apply(axis=1)` with custom Python functions when vectorized NumPy / pandas column operations could run 50x faster with 0 memory overhead.
Interviewers assess whether you write idiomatic, vectorized pandas code instead of slow row-by-row procedural Python loops.
Construct the solution logically from first principles to avoid typical edge case pitfalls.
Use boolean masks with `.loc[row_mask, col_list]` to avoid chained assignment warnings.
subset = df.loc[df['status'] == 'completed'].copy()
Use numpy/pandas native operations like `.groupby()`, `.transform()`, or column arithmetic.
df['rev_share'] = df['revenue'] / df.groupby('country')['revenue'].transform('sum')Sort values and reset index to match the required evaluation output contract.
result = df.sort_values('rev_share', ascending=False).reset_index(drop=True)result = arr.reshape(3, 4)
Real code patterns candidates submit that fail the grading suite.
results = []
for i, row in df.iterrows():
results.append(row['val'] * 2)Three recurring syntax and semantic traps relevant to this problem domain.
Modifying a filtered slice like df[df.age > 30]['salary'] = 5000 modifies an ephemeral copy instead of the underlying dataframe.
df[df['active'] == True]['status'] = 'verified' # ❌ SettingWithCopyWarning
df.loc[df['active'] == True, 'status'] = 'verified' # ✅ Idiomatic inplace assignment
Calling df.groupby('category').agg(...) places 'category' into the MultiIndex/Index, making subsequent column references fail.
res = df.groupby('dept')['salary'].mean(); print(res['dept']) # ❌ KeyErrorres = df.groupby('dept', as_index=False)['salary'].mean() # ✅ Keeps column intactLaunch our in-browser coding environment. Run queries, view execution plans, and get instant comparative diff grading with no setup.
Iterating rows with for index, row in df.iterrows() is an anti-pattern in data science interviews.
for i, r in df.iterrows(): df.at[i, 'total'] = r['price'] * r['qty'] # ❌ Slow
df['total'] = df['price'] * df['qty'] # ✅ C-speed vectorization