I have a large time series data frame (called df), and the first 5 records look like this:
df
stn years_of_data total_minutes avg_daily TOA_daily K_daily
date
1900-01-14 AlberniElementary 4 5745 34.100 114.600 0.298
1900-01-14 AlberniWeather 6 7129 29.500 114.600 0.257
1900-01-14 Arbutus 8 11174 30.500 114.600 0.266
1900-01-14 Arrowview 7 10080 27.600 114.600 0.241
1900-01-14 Bayside 7 9745 33.800 114.600 0.295
Goal:
I am trying to remove rows where any of the strings in a list are present in the 'stn' column. So,I am basically trying to filter this dataset to not include rows containing any of the strings in following list.
Attempt:
remove_list = ['Arbutus','Bayside']
cleaned = df[df['stn'].str.contains('remove_list')]
Returns:
Out[78]:
stn years_of_data total_minutes avg_daily TOA_daily K_daily
date
Nothing!
I have tried a few combinations of quotes, brackets, and even a lambda function; though I am fairly new, so probably not using syntax properly..