Code Room
Code reviewMedium
Question
Review this Python feature-loading code.
Model performance quietly drops after an upstream export-format change, but nothing errors. What dtype/data bug is hiding here?
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
import pandas as pdimport numpy as np def load_features(path): df = pd.read_csv(path) # 'amount' sometimes has values like '1,200' or 'N/A' from the export X = df[["amount", "age", "score"]].astype(str) X = X.apply(lambda c: c.str.replace(",", "")) X = X.apply(pd.to_numeric, errors="coerce") X = X.fillna(0) return X.valuesRun or narrate your approach, then ask the coach.