I have a DF named "faves", with a column named "fruit". In the column, there are four possible choices: apple, orange, grape, and strawberry. I am trying to drop all of the rows from the fruit column that isn't an apple or an orange. The code I got so far is :
X = faves[ (faves['fruit'] != "apple") & (faves['fruit'] != "orange") ].index
faves = faves.drop(faves[faves['fruit'] == X])
whenever I try it I get KeyError: 'fruit'