I have a large data frame
and I am interested in filtering the dataset based on a certain condition. Only 1 row follows the condition. I would like to turn 8 variables of this row to NAN
, I am not doing the right thing.
Here is the idea
# filter the dataset
error_in_the_data = df_frame.start == "embed"
df_frame.loc[error_in_the_data,"Info_1":"Info_8"]
How do I mask this variables in that row that fufil the condition of error_in_the_data
to NAN
You are really close, only assign np.nan
for filter by mask and by columns names:
df_frame.loc[error_in_the_data,"Info_1":"Info_8"] = np.nan