pandas filter regex code example
Example 1: how to apply regex to pandas column
import re
#a string
str = '{63_:_foo},,bar,_mango_,apple'
#split string into chunks
chunks = re.split('[{_}:,][_,]',str)
#print chunks
print(chunks)
Example 2: pandas filter
df[(df['year'] > 2012) & (df['reports'] < 30)]
Example 3: pandas filter
#To select rows whose column value is in list
years = [1952, 2007]
gapminder.year.isin(years)