0

Good afternoon, i am trying to do an exact text search for a dataframe column. As an example i was to find every record that is Blue, by my current code listed below returns values such as Blue Bird, Bluey, etc etc

here is my table:

   UserId  Application
    1       Blue
    2       Bluey
    2       Blue Bird

below are 2 seperate lines of code i have tried to achieve the same purpose

dfsearch = df[df['Application'].str.match('Blue', na=False)]
dfsearch = df[df['Application'] == 'Blue']

but instead it is returning the all instances of Blue instead of just Blue... Please help!

output i desire:

 UserId  Application
        1       Blue   
James Scott
  • 181
  • 1
  • 13
  • `df[df['Application'] == 'Blue']` should work. – rafaelc Mar 23 '19 at 21:57
  • @RafaelC unfortunately its not :( im not sure why its not either. any ideas? – James Scott Mar 23 '19 at 21:58
  • It definitely works. Check if you are referencing the right variables, printing out the right data frame, etc etc. Restart your kernel and start from scratch could also be a good idea. But it definitely works. – rafaelc Mar 23 '19 at 21:59
  • @RafaelC it works! it was something going on with the kernel, i had to restart it and start over unfortunately but it works! thanks! – James Scott Mar 23 '19 at 22:22

0 Answers0