使用isin:
cleaned = df[~df['stn'].isin(remove_list)]In [7]:remove_list = ['Arbutus','Bayside']df[~df['stn'].isin(remove_list)]Out[7]: stn years_of_data total_minutes avg_daily date 1900-01-14 AlberniElementary 45745 34.1 1900-01-14 AlberniWeather 67129 29.5 1900-01-14 Arrowview 7 10080 27.6 TOA_daily K_daily date 1900-01-14 114.6 0.298 1900-01-14 114.6 0.257 1900-01-14 114.6 0.241
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)