I'm trying to match a pattern with a column of a dataframe
pattern='pgk'
df = pd.DataFrame([['merged_pgk', 10], ['merged_Pgk', 3], ['merged_pgk_stim', 12], ['merged_Scp1', 5]], columns=['condition','count'])
I want the row where pattern is in the column condition.
df[df['condition'].str.lower().str.contains(pattern)]
I tried this but the problem here is that it will return pgk row (what I want) but I got also pgk_stim row (what I don't want)