Skip to content
Advertisement

Tag: string-matching

Returning entries from a data set that contain a specific string in Python

I have a data set called df with the information of the name of the Drugs that has been administered. The column “drug_name” consists of all the various drug names. I would like to extract entries that only contain a specific name of the drugs. I have tried the .str.contain method df_adr= df[df[“drug_name”].str.contains(“epinephrine”)==True] This works but the problem is it

Advertisement