I'm trying to write some code which looks at the column names and sets the column value to 0 if that column name contains a specific string. I have a dataset with columns similar to this:
date apples_sold bananas_sold pineapples_sold orange_sold
I want to update any columns with the string "apple" to make every row 0 for that column. If the column doesn't contain "apple" then the value should remain.
I tried looping through the column names but am unsure the syntax as I don't want to hardcode the specific column names.