Last active
August 29, 2015 14:24
-
-
Save achim/4e346cf4932d5c0e7dfc to your computer and use it in GitHub Desktop.
Display pickled pandas dataframes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from __future__ import print_function | |
import webbrowser | |
import cPickle as pickle | |
import tempfile | |
import argparse | |
def main(): | |
parser = argparse.ArgumentParser(description='Display .df.pickle files') | |
parser.add_argument('file', help='path to the file to display') | |
args = parser.parse_args() | |
with tempfile.NamedTemporaryFile(suffix='.html', delete=False) as fout: | |
with open(args.file, 'r') as fin: | |
df = pickle.load(fin) | |
print(df.to_html(), file=fout) | |
print(fout.name) | |
webbrowser.open('file://' + fout.name) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment