Skip to content

Instantly share code, notes, and snippets.

@bt0DotNinja
Created January 12, 2017 19:34
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 bt0DotNinja/c235a39152c0ef7606fa63132c42ae3b to your computer and use it in GitHub Desktop.
Save bt0DotNinja/c235a39152c0ef7606fa63132c42ae3b to your computer and use it in GitHub Desktop.
a table generator from candidates CSV
#!/usr/bin/env python
# Alberto Rodriguez Sanchez (bt0dotninja@fedoraproject.org)
import sys
import pandas as pd
if __name__ == '__main__':
assert len(sys.argv) == 3 , "Usage: python tables.py CSVfile OutputHtmlFile"
df = pd.read_csv(sys.argv[1])
pd.set_option('max_colwidth', 100000) # quick and dirty fix
df["Interview"]=df["Interview"].apply(lambda x: '<a href="{0}">Yes</a>'.format(x) if x != 'No' else x)
df["Wiki Page"]=df["Wiki Page"].apply(lambda x: '<a href="{0}">Here</a>'.format(x))
df.to_html(sys.argv[2], escape=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment