I have a pandas table that contains a column which has a String datatype. What I need is to exclude any rows that have "Not found" as a string inside them from the data frame. I am currently trying:
df[df.some_column != "Not found"] but that is not working
Looking forward to replies.
Sample data:
card_number effective_date expiry_date grouping_name Ac. Year code
0 1206090 28 Sep 2012 21 Aug 2013 Dummy no.1 201213
1 1206090 21 Feb 2013 21 Aug 2013 Dummy no.2 201213
2 1206090 28 Sep 2012 30 Nov 2012 Dummy no.3 201213
3 1206090 03 Dec 2012 21 Aug 2013 Dummy no.3 201213
4 1206090 23 Apr 2013 31 Aug 2013 Dummy no.4 201213
5 1206090 28 Sep 2012 21 Aug 2013 Dummy no.5 201213
6 1206090 28 Sep 2012 21 Aug 2013 Dummy no.6 201213
7 1206090 24 Oct 2012 07 Aug 2013 Not found 201213
8 1206090 08 Jan 2013 08 Jan 2013 Not found 201213
9 1206090 08 Jan 2013 31 Aug 2013 Not found 201213
10 Not found 03 Jul 2013 21 Aug 2013 Dummy no.1 201213
11 Not found 03 Jul 2013 21 Aug 2013 Dummy no.2 201213
Extra note: My string matching must be extremely weird... When running df[grouping_name] != "Not found" I get true for 7,8,9... does anyone know why?
str.contains; see here; as indf.some_column.str.contains('Not Found', na=False, regex=False)~to the beginning and dropregex=False; i guess that is added in13.1;