2

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

vestland
  • 55,229
  • 37
  • 187
  • 305

1 Answers1

3

(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.

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
  • Thank you for answering! I'm probably only revealing my lack of fundamental Python knowledge here, but how can variables be accessed using for example `print(df)` at the same timet that there is not functionality to display the namespace in the Variable Explorer? – vestland Apr 01 '19 at 12:05
  • 1
    Since the default notebook kernels are not Spyder kernels (yes, our kernels are special, i.e. they have several additions to work with Spyder), they can't communicate to Spyder to tell it how and when to update the Variable Explorer. – Carlos Cordoba Apr 01 '19 at 15:05