How to check if a value is in the list in selection from pandas data frame?
Use isin
df_new[df_new['l_ext'].isin([31, 22, 30, 25, 64])]
You can use pd.DataFrame.query
:
select_values = [31, 22, 30, 25, 64]
df_cut = df_new.query('l_ext in @select_values')
In the background, this uses the top-level pd.eval
function.