python – find specific name in a df

df2 = df.filter(regex='spike')
print(df2)

Here is what the above code is Doing:
1. We’re using the filter method on the DataFrame.
2. We’re using a regular expression to select columns that contain the word “spike”.
3. We’re assigning the resulting DataFrame to a new variable called df2.
4. We’re printing out the first five rows of df2.