I have the following data frame:
df = pd.DataFrame({'col1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'col2': [-3, 4, 5, 4, 1, 0, 0, 1, 3, 4], 'col3': ['a','a','b', 'a','c','a','a','a','a','a']})
I want to drop the rows which do not have 'a' in the third column. In this case, the third and fifth rows are to be dropped and I can do it with the following command
df.drop([2,4])
Is there a way to do it without referring to the index set [2,4] and directly involving 'col3' and 'a'?
I have a big dataset, and I only need one value, say 'a', in the last columns and drop all the rows which do not have 'a' in the last column.