如何连接到现有的 Jupyter Notebook 内核并使用变量资源管理器检查变量?
How to connect to an existing Jupyter Notebook kernel and inspect variables using the Variable explorer?
如果我通过 Jupyter Notebook 获得内核 运行,我可以使用 Options > Connect to an exisisting kernel > Browse
从 Spyder 轻松连接到它。现在我可以访问 Jupyter 内核并通过 运行 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
里面dataframe不可用呢?
(这里是 Spyder 维护者) 发生这种情况是因为笔记本创建的内核没有在我们的变量资源管理器中显示其命名空间所必需的功能。
抱歉,目前没有简单的解决方法。
如果我通过 Jupyter Notebook 获得内核 运行,我可以使用 Options > Connect to an exisisting kernel > Browse
从 Spyder 轻松连接到它。现在我可以访问 Jupyter 内核并通过 运行 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
里面dataframe不可用呢?
(这里是 Spyder 维护者) 发生这种情况是因为笔记本创建的内核没有在我们的变量资源管理器中显示其命名空间所必需的功能。
抱歉,目前没有简单的解决方法。