I am making a list of column names from a pandas dataframe 'df' whose name starts with string_1.
string_1 = "some string"
lookupcol = [col for col in df.columns if string_1 in col]
But the above code is also returning column names which contains string_1.
So my typical output looks like this.
['some string 1990', 'have some string', 'some string 1991']
I want to use a regex expression, so that result include only those column names which starts with 'some string'.
Output should be like this:
['some string 1990', 'some string 1991']