Created
September 20, 2017 06:29
-
-
Save infinite-Joy/78ca76c16e40244b2bfa6df8bf2dbbc2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| print('Changing to jsonstr to feed to html file') | |
| jsonstr = df_state.to_json(orient='records') | |
| # Create an HTML file that will have the visualisation | |
| from IPython.core.display import display, HTML | |
| HTML_TEMPLATE = """<link rel="import" href="/nbextensions/facets-dist/facets-jupyter.html"> | |
| <facets-dive id="elem" height="600"></facets-dive> | |
| <script> | |
| var data = {jsonstr}; | |
| document.querySelector("#elem").data = data; | |
| </script>""" | |
| html = HTML_TEMPLATE.format(jsonstr=jsonstr) | |
| out = HTML(html).data | |
| # write the html to a file | |
| with open('html_file.html', 'w') as f: | |
| f.write(out) | |
| print('file saved') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment