Skip to content

Instantly share code, notes, and snippets.

@winnydejong
Last active November 19, 2020 21:03
Show Gist options
  • Save winnydejong/86b4150b16f231dee511e6884c86394f to your computer and use it in GitHub Desktop.
Save winnydejong/86b4150b16f231dee511e6884c86394f to your computer and use it in GitHub Desktop.
Regex filter: select rows if column matches regex
import re
import pandas as pd
#returns rows that match regexpattern for given column
df[df.COLUMNNAME.str.match('REGEXPATTERN', re.IGNORECASE)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment