ignore-case

pandas findall re.ignorecase doesn't work

Pandas findall re.IGNORECASE doesn't work Question: I have a list of keywords: keywords = [‘fake’, ‘hoax’, ‘misleading’, etc.] I’d like to search the text column of DataFrame df1 for the above keywords and return rows containing these keywords (exact match), both in uppercase and lowercase (case-insensitive). I tried the following: df2 = df1[df1.text.apply(lambda x: any(i …

Total answers: 1

How to set ignorecase flag for part of regular expression in Python?

How to set ignorecase flag for part of regular expression in Python? Question: Is it possible to implement in Python something like this simple one: #!/usr/bin/perl my $a = ‘Use HELLO1 code’; if($a =~ /(?i:use)s+([A-Z0-9]+)s+(?i:code)/){ print “$1n”; } Letters of token in the middle of string are always capital. Letters of the rest of words …

Total answers: 3