Guest User

Untitled

a guest
Nov 22nd, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. import pandas as pd
  2.  
  3. d = {'col1': ['abc', 'ave','abd', 'ave','abe', 'ave'], 'col2': [0,1,0,1,0,1]}
  4.  
  5. df = pd.DataFrame(data=d)
  6.  
  7. lst = ['abc','abd','abe']
  8.  
  9. print(df[df.col1.str.contains("ab")])
  10.  
  11. df[df.col1.str.contains("ab")].col2 +=1
Add Comment
Please, Sign In to add comment