小编R.D*_*.D.的帖子

在Jupyter扩展中访问数据对象

我已经为我的Jupyter笔记本创建了一个javascript扩展,它将为我绘制一些数据.现在我在扩展程序中对数据进行了硬编码.我的问题:有没有办法访问笔记本中存在的数据对象?

例如,下面是扩展的一些示例代码:

define([
    'base/js/namespace'
], function(
    Jupyter
) {
  function test_second_extension() {

    var handler = function () {
      console.log(
          'This is the current notebook application instance:',
          Jupyter.notebook
      );
      var data = [{"x": 1, "y": 5}, {"x": 2, "y":12}, {"x": 3, "y": 27}];
      console.log(data);
    };

    var action = {
        icon: 'fa-comment-o', // a font-awesome class used on buttons, etc
        help    : 'Print notebook instance',
        help_index : 'zz',
        handler : handler
    };
    var prefix = 'test_second_extension';
    var action_name = 'show-alert';

    var full_action_name …
Run Code Online (Sandbox Code Playgroud)

javascript python python-3.x jupyter-notebook

14
推荐指数
1
解决办法
176
查看次数

标签 统计

javascript ×1

jupyter-notebook ×1

python ×1

python-3.x ×1