python - matching a substring in a dateframe column -
i want match id column in dataframe if name contain string 'test_'. there simple way boolean vector df.id == 'something' df.id contains 'test_'.
iiuc following should work:
df.loc[df['id'].str.contains('test_'), 'id']
this return id's contain partial string
if want boolean array against rows:
df['id'].str.contains('test_')
Comments
Post a Comment