Use python dataframe in clientside javascript


Hi - I’ve got a notebook with some client-side javascript implementing d3 & Plotly plots plus a http fetch, see:

Is there any way I could load a dataframe in python, marshall the dataframe easily, ie via jupyter’s websockets connection, not via a http fetch but with some simple python/javascript combo. I’m looking for something as simple as importing a dataframe in R from python

Note, this is clientside javascript for in-browser javascript data visualization - ie. %%javascript magic, not serverside nodejs (pixiedust etc).

Bonus points: is there any way we could have intellisense/code completion for clientside javascript?

I’m looking to get as close as possible to replicating the experience within Jupyter, to allow python data scientists to explore javascript data viz alongside python more easily.



This works for small dataframes:

from IPython.display import Javascript

However, it quickly falls over for larger dataframes.

If anyone has any better ideas, or can comment on intellisense/code completion in %%js then please let me know!