pixiedust / pixiedust_node

Jupyter magic to allow Node.js code to run in a notebook
https://medium.com/ibm-watson-data-lab/running-node-js-notebooks-in-watson-studio-a8f6545d8299
Apache License 2.0
213 stars 24 forks source link

Use Nodejs vars in Python #12

Closed bradnoble closed 6 years ago

bradnoble commented 6 years ago

Today, I can use store to save Nodejs vars for use in Python cells, but I can't do the opposite. That is, I can't access Python vars in %%node cells.

glynnbird commented 6 years ago

So the syntax for "store" is like this:

%%node
var x = [ { a:1, b:2, c:3}, {a:3, b:4, c:2}];
store(x, 'y');

and a data frame 'y' is made available in Python.

If you need to move Python data to Node, then presumably you are doing Python code - so the mechanism needs to be Python:

store(df, 'z')

would be the nearest equivalent syntax? Or I could do node.store(df,'z') ?

DTAIEB commented 6 years ago

@glynnbird we should implement like the scala bridge and automatically import all the variables that we can bridge from the Notebook global scope. That way you don't need to use store on Python, just declare the variable in Python and start using it in Node

glynnbird commented 6 years ago

This feature is present in the new 0.2.0 release