Sharing Variables Between Python & Node.js in Jupyter Notebooks

They live apart and speak different languages, but these variables hold common values

!pip install pixiedust_node
import pixiedust_node
console.log("Today's date is", new Date());
npm.install( ('request', 'request-promise') )
const request = require('request-promise');
Share Python and Node.js variables in multiple directions. Photo by Brendan Church on Unsplash

Sharing variables (shariables?)

a = 'hello'
b = 2
c = False
d = {'x':1, 'y':2}
e = 3.142
f = [{'a':1}, {'a':2}, {'a':3}]
console.log(a, b, c, d, e, f);
// hello 2 false {y:2, x:1} 3.142 [{ a:1 }, { a:2 }, { a:3 }]
var i = 'world';
var j = 3;
var k = true;
var l = { z:99 }
var m = 2.7182;
var n = ['apples', 'oranges'];
# (u'world', 3, True, {u'z': 99}, 2.7182, [u'apples', u'oranges'])
var googlehomepage = '';
request.get('').then(function(data) {
googlehomepage = data;
print('Fetched Google homepage');

How to upgrade

!pip --upgrade pixiedust_node

Why do this?



Things we made with data at IBM’s Center for Open Source Data and AI Technologies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store