Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import re
def filter_fonts(df, regex_filters):
df_new = pd.concat([df.filter(regex=re.compile(regex, re.IGNORECASE), axis=1).sum(axis=1).astype(bool) for regex in regex_filters], axis=1)
mask = df_new.all(axis=1)
return list(df.loc[mask].family)
filtered_fontnames = filter_fonts(df, ['Black', 'cyrillic', '_serif'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment