Skip to content

Instantly share code, notes, and snippets.

@erraticgenerator
Created November 1, 2020 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erraticgenerator/0bfa88d8be5f3d48c6d564bfd77ea591 to your computer and use it in GitHub Desktop.
Save erraticgenerator/0bfa88d8be5f3d48c6d564bfd77ea591 to your computer and use it in GitHub Desktop.
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'])
filtered_fontnames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment