Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- d = {'col1': ['abc', 'ave','abd', 'ave','abe', 'ave'], 'col2': [0,1,0,1,0,1]}
- df = pd.DataFrame(data=d)
- lst = ['abc','abd','abe']
- print(df[df.col1.str.contains("ab")])
- df[df.col1.str.contains("ab")].col2 +=1
Add Comment
Please, Sign In to add comment