my dataframe, df, contains a set of columns including two like:
'age-15y','age-5y'
i want to apply a filter to the dataframe for the sake of obtaining the columns whose names end in each string, so '5y' and '15y'
would be separate.
if i try
df.filter(regex='5y'+'$')
then i will obtain the columns ending in '15y' as well, which is not what I am after
is there a way to conveniently accomplish what i am after? i was hoping there was a way to use the regex and specify the number of characters that it should apply to