I have a list of column names from a data frame:
['s_0','s_1','s_2','s_0_m','s_1_m','s_2_m']
I need to make a comprehension list and select only the names without m at the end (s_0, s_1...) or only the names with m at the end (s_0_m, s_1_m etc).
So I thought it would be something like
[col for cols in df.columns if re.search(regex,col)]
But I can't figure out the regex expression, please help me!