Comments (7)
this sounds a bit like #6
from itables.
Thanks @GZR5876 for reporting this. Yes I agree, this sounds like #6. I think this is because the inclusion of the javascript code in the notebook is done very simply, possibly too simply... at least it works with nbconvert, which was not the case of widgets when I gave the first try at this projet.
Anyway, if we want to make some progress on this, maybe we should find what the javascript error is? Does your browser shows anything that could help us?
from itables.
Hi @neon-ninja , @GZR5876 , I think I understood the issue.
When the user imports itables
, often in the first cell, an invisible output is displayed, which loads the datatables.net library.
If the user either
- reloads the notebook (without having saved that cell)
- or reexecutes that cell
then that invisible output is not there any more, and the calls to datatables.net fail.
I can think of two workarounds
- execute this
from itables.javascript import load_datatables
load_datatables()
as the first cell. Save the notebook, and then reload it (I can't explain why we need to reload)
- stop the kernel and clear the outputs, save the notebook, reload the notebook, and then run the notebook
Obviously we should think of a better approach. At the moment (itables version 0.2.2) I'd probably recommend loading the JS library explicitly at the top of the notebook
from itables.javascript import load_datatables
load_datatables()
I am also having a look at how Plotly do this in the context of a Jupyter Notebook. Apparently the load of the Plotly JS library is associated to the first plot. So, if you have a notebook made of two cells:
import plotly.graph_objects as go
and
go.Figure(data=[go.Bar(y=[1,3,2])])
then
- if you execute the notebook, save and reload, the graph is still there
- if you execute the cell 2 a second time, then
a) the graph is still there, until you save and reload
b) when you save and reload, you need to restart the kernel and run the cell again to get the plot displayed.
So to summarize,
- the issue in
itables
is very visible and too easy to trigger because the loading of the JS library is done byimport itables
, and the user does not expect that cell to have an important output - associating the loading of the JS library to the display of the table would make it more similar to how it is done in Plotly. It is a better approach, but it does not solve all the problems
- so maybe we should mention that in the documentation and also offer a way to explicitly load the JS library like above when we called directly
load_datatables()
from itables.
This should be fixed now in itables>=0.3.0
. Please note that the initialization now works a bit differently - to display all the tables interactively, you should start your notebook with
from itables import init_notebook_mode
init_notebook_mode(all_interactive=True)
from itables.
I appear to be having the exact same issue, this originally worked, but having restarted the kernel, the outputs are all blank. I'm using itables==0.3.0 and JupyterHub. I have the following 3 blocks in a fresh notebook and it works fine, yet in an existing notebook even after a kernel restart, there is no output as described above.
from itables import init_notebook_mode
init_notebook_mode(all_interactive=True)
iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')
iris
Existing notebook with no output even after restart:
Fresh notebook seems to work OK:
from itables.
Hi @mattwatkinscs , thank you for your input. May I ask what is the outcome if a) you restart the kernel and b) you reload the notebook (Ctrl+R)? Thanks!
from itables.
Hi @mattwatkinscs , thank you for your input. May I ask what is the outcome if a) you restart the kernel and b) you reload the notebook (Ctrl+R)? Thanks!
I have the exact same issue. For me it is both a and b. It only works again if I shut down the kernel, close the tab for the notebook and reopen the notebook again in a new tab.
from itables.
Related Issues (20)
- Column width miss-match in notebook vs jupyter-book HOT 2
- how to highlight table row based on value in a column HOT 3
- Elements translation HOT 2
- Add Quarto to supported editors HOT 7
- Exporting table to pdf with columnDefs styling applied HOT 5
- Does itables block rendering of ui elements? HOT 2
- Databricks support? HOT 1
- Acknowledging itables
- Control width of table, search, tabulation, etc in an HTML report. HOT 4
- Rangeindex index not displayed HOT 2
- OverflowError when showing Polars data frames containing unsigned integer types HOT 2
- Pandas background gradient (heatmap) HOT 2
- Pandas Style fail to render in Colab
- Remove the indirect dependency on jinja2
- Set Advanced Parameters as Global Options HOT 5
- A bug in displaying sorted tables HOT 3
- Immobilizing columns HOT 1
- Row selection? HOT 5
- used pandas styles with show raise TypeError HOT 2
- html in column names HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itables.