CermakM / jupyter-datatables

Jupyter Notebook extension leveraging pandas DataFrames by integrating DataTables and ChartJS.
MIT License
238 stars 27 forks source link

how to convert datatables to static html successfully #6

Closed orcahmlee closed 5 years ago

orcahmlee commented 5 years ago

Thank you for working on this package.

I could successfully render the iris data frame on jupyter notebook. However, after convert to static html, the data table doesn't appear. Here are my print screens.

Screen Shot 2019-06-03 at 11 16 32

Save Notebook Widget State Screen Shot 2019-06-03 at 11 18 25

Download as HTML(.html) Screen Shot 2019-06-03 at 11 18 35

It's gone Screen Shot 2019-06-03 at 11 18 07

CermakM commented 5 years ago

Hello and thank you!

This library does not work with widgets, altho that is a pretty good pointer right there, that I might want to check out whether the "Save widget state" is a more suitable option. You can read more about this in the jupyter-require readme section.

Anyway, if you want to save the plot state here, you gotta finalize it first. You've got two options. Either you use the shield-like button Save and Finalize dedicated for that purpose, or you properly close and halt the notebook.

Solution

Before exporting to HTML, finalize the notebook state using the dedicated Save and Finalize button on the right of the Save and checkpointone in the Jupyter notebook toolbar.

Let me know if everything works!

Marek

orcahmlee commented 5 years ago

@CermakM Thanks for your kindly reply.

I tried click Save and Finalize before Download as HTML. The result was not quite success.

I can see the jupyter-datatable showed on static html, however, the static html seems only snapshot the first page for jupyter-datatable. The buttons do not work after exporting, such as Print, CSV, PDF, sorting, pagination...etc.

Hello and thank you!

This library does not work with widgets, altho that is a pretty good pointer right there, that I might want to check out whether the "Save widget state" is a more suitable option. You can read more about this in the jupyter-require readme section.

Anyway, if you want to save the plot state here, you gotta finalize it first. You've got two options. Either you use the shield-like button Save and Finalize dedicated for that purpose, or you properly close and halt the notebook.

Solution

Before exporting to HTML, finalize the notebook state using the dedicated Save and Finalize button on the right of the Save and checkpointone in the Jupyter notebook toolbar.

Let me know if everything works!

Marek

CermakM commented 5 years ago

@orcahmlee Yep, as long as you can see the table, that is the expected behaviour. What get's embedded is only a snapshot of the current state. The purpose of it is the security of your data, we're preserving only the data that you want to show your audience.

What I could do, however, is denote it somehow, so that it was clear that the visualization is just a snapshot, I'll think about it (or you can create a feature request for it, if you want to! ;)) and see what I can do.

Anyway, that is the correct behaviour.

Proposal: Disable all of the buttons once finalized so that it is clear that what we see is just a snapshot of the data.

Cheers, Marek

JulianWgs commented 5 years ago

I would much rather have an interactive version of the table in the static html. Of course the author needs to be aware of the risk.

This would add a lot more value to a static html export.

CermakM commented 5 years ago

@JulianWgs Perhaps it would and I understand that you might wanna use it that way, but this is not the concept of this project and I don't think it should be the concept in general. Let me elaborate.

The purpose of it is to eliminate security risks, to strip the unwanted JavaScript from the notebook to protect your machine (Each time you open the notebook, every single script is run automatically and without your permission), your data and your intellectual property (you might not want to share the script that generated the plot? But you do because it is embedded into the notebook?).

If you do need the interactivity, why wouldn't you just open the Jupyter Notebook itself, or run it in binder? What is the value of the static HTML export?

Cheers, Marek

JulianWgs commented 5 years ago

Sorry, for the late reply. There is another project offering interactive tables: https://github.com/quantopian/qgrid. The feature set is "similar", but on the other project it is also not possible to export the interactive table to a static html. This feature will never work there, because of how the project needs a running kernel.

Genererating interactive tables in a static html could be a distinct feature of this project!

A huge benefit is that you could show of interactive reports in nbviewer and not binder or nbinteract. Also some clients prefer the html version of the report send by mail. (Not ideal I know...)

This is the same reason I prefer plotly over bokeh/matlab. It offers javascript based interactive visualization without much work. Of course for "richer" visualization you would use something else, but for a quick report, it is very nice.

Also I dont want to show off huge tables with a lot of data, but just an aggregated form.

Thank you!

Cheers Julian

CermakM commented 5 years ago

Thank you for the feedback!

Unfortunately, having interactive plots in the static exports is currently out of the scope of this project and is not planned in the near future. The idea is to keep the reports and the notebook minimal and keep only the relevant information.

I understand that having interactive static exports might be attractive for some users, but I would be bold enough to suggest them to open up the report in the Notebook or binder and explore it there :).

Thank you once again, hope that you'll be satisfied with the future upgrades to this project (feel free to check out the Project board if you wish).

PS: I believe this issue can be closed, if you agree, feel free to close it.

Cheers, Marek