Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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