Task: Replace Values with NaN in a Pandas DataFrame Using Boolean Conditions
Task: Replace Values with NaN in a Pandas DataFrame Using Boolean Conditions: a task in Terminal-Lego-15k (Harbor dataset). In pandas, a common operation is replacing specific "bad" values in a DataFrame column with NaN . A naive approach using chained indexing (e.g., df df.y == 'N/A' 'y' = np.nan…
The task
In pandas, a common operation is replacing specific "bad" values in a DataFrame column with `NaN`. A naive approach using chained indexing (e.g., `df[df.y == 'N/A']['y'] = np.nan`) fails silently because it operates on a copy of the DataFrame rather than the original.
Part of PrimeIntellect/Terminal-Lego-15k.