aliquote.org

October 2, 2019

I believe this the canonical way to filter in a Pandas data frame, say d, rows that contain or better, match exactly, the word “gene”:

d[d["type"].str.match("gene", na=False)]

(The na=False option is just because there are some NaN values.)

Now I understand why I prefer functional languages, and more specifically why I prefer to write and chain together simple functions in Python rather than implementing complex class with shadowed methods, setters and getters. #python