[Solved] How to use python pandas to find a specific string in various rows


You can try this code below:

import pandas as pd

df = pd.read_csv(r'your csv file path')
res = df[(df.apply(lambda s: s.eq('CA').any(), axis=1))]
print(res)

0

solved How to use python pandas to find a specific string in various rows