问题描述
如果我有一个通过Jupyter Notebook运行的内核,则可以使用Options > Connect to an exisisting kernel > Browse
从Spyder轻松连接到它.现在,只需运行df
,即可访问Jupyter内核并查看数据框或任何其他变量:
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代码段:
#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代码段:
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
但是为什么Spyder的Variable Explorer
中的数据框不可用?
But why is the dataframe not available in the Variable Explorer
in Spyder?
推荐答案
(此处为[Spyder维护程序] ),这是因为笔记本计算机创建的内核不具备显示其内核所需的功能.变量浏览器中的命名空间.
(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.
这篇关于如何使用变量浏览器连接到现有的Jupyter Notebook内核并检查变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!