How to connect to an existing Jupyter Notebook ker

2019-07-08 10:28发布

If I've got a kernel running through a Jupyter Notebook, I can easily connect to it from Spyder using Options > Connect to an exisisting kernel > Browse. Now I can get access to the Jupyter kernel and view the dataframe or any other variable by just running df:

Jupyter snippet:

#imports
import numpy as np
import pandas as pd

# Some sample data
np.random.seed(1234)
df = pd.DataFrame({'A1':np.random.normal(10, 1, 8),
                   'B1':np.random.normal(20, 2, 8)})

Spyder snippet:

df

# output:
          A1         B1
0  10.471435  20.031393
1   8.809024  15.514630
2  11.432707  22.300071
3   9.687348  21.983892
4   9.279411  21.906648
5  10.887163  15.957490
6  10.859588  19.331845
7   9.363476  20.004237

But why is the dataframe not available in the Variable Explorer in Spyder?

enter image description here

1条回答
Luminary・发光体
2楼-- · 2019-07-08 11:08

(Spyder maintainer here) This happens because the kernels that are created by the notebook doesn't have the functionality necessary to display its namespace in our Variable Explorer.

And there's no easy workaround for that at the moment, sorry.

查看更多
登录 后发表回答