如何防止在Jupyter笔记本中显示特定的情节?我在笔记本中有几个图,但我希望将它们的一部分保存到文件中,而不是在笔记本上显示,因为这会显着减慢.
Jupyter笔记本的最小工作示例是:
%matplotlib inline
from numpy.random import randn
from matplotlib.pyplot import plot, figure
a=randn(3)
b=randn(3)
for i in range(10):
fig=figure()
plot(b)
fname='s%03d.png'%i
fig.savefig(fname)
if(i%5==0):
figure()
plot(a)
Run Code Online (Sandbox Code Playgroud)
如你所见,我有两种类型的图,a和b.我想要绘制和显示一个,我不希望显示b图,我只是想让它们保存在文件中.希望这会加速一些事情,并且不会用我不需要看的数字来污染我的笔记本.
感谢您的时间
我用python库和Jupyter创建了一个docker镜像.我使用选项启动容器-p 8888:8888,以链接主机和容器之间的端口.当我在容器中启动Jupyter内核时,它正在运行localhost:8888(并且没有找到浏览器).我用了这个命令jupyter notebook
但是从我的主机,我必须使用什么IP地址与主机的浏览器中的Jupyter一起工作?
随着命令ifconfig,我发现eth0,docker,wlan0,lo...
谢谢 !
有点傻但是,有一个快捷键可以将代码单元格更改为markdown单元格.要放置一个markdown单元格,我必须插入一个单元格,然后转到工具栏菜单(主菜单栏下方),然后选择markdown而不是代码.
我正在使用 jupyter 笔记本并安装。
ipywidgets==7.4.2 widgetsnbextension pandas-profiling=='.0.0
Run Code Online (Sandbox Code Playgroud)
我也跑了:
!jupyter nbextension enable --py widgetsnbextension
Run Code Online (Sandbox Code Playgroud)
但运行时:
from pandas_profiling import ProfileReport
profile = ProfileReport(df, title="Pandas Profiling Report", explorative=True)
profile.to_widgets()
Run Code Online (Sandbox Code Playgroud)
我收到错误:
ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
Run Code Online (Sandbox Code Playgroud)
知道为什么吗?尝试了建议的解决方案。
我在我的centos6.5服务器上启动了一个Jupyter Notebook服务器.而jupyter正在运行
[I 17:40:59.649 NotebookApp] Serving notebooks from local directory: /root
[I 17:40:59.649 NotebookApp] 0 active kernels
[I 17:40:59.649 NotebookApp] The Jupyter Notebook is running at:https://[all ip addresses on your system]:8045/
[I 17:40:59.649 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Run Code Online (Sandbox Code Playgroud)
当我想在同一局域网中远程访问Jupyter时,比如打开http://192.168.1.111:8045/,我根本无法打开Jupyter页面.顺便说一句,我可以成功访问远程centos服务器.
可能的原因是什么?
是否有可能在IPython笔记本中以某种不同的颜色显示某些输出?例如,有些东西:
print("Hello Red World", color='red')
Run Code Online (Sandbox Code Playgroud) 我正在努力为python做一些科学的东西设置一个良好的环境.为此,我安装了Jupyter和miniconda.
然后我希望能够拥有不同的环境,并将它们与Jupyter笔记本一起使用.所以我用conda创建了两个自定义env:py27和py35.
> conda env list
# conda environments:
#
py27 /Users/***/miniconda3/envs/py27
py35 /Users/***/miniconda3/envs/py35
root * /Users/***/miniconda3
Run Code Online (Sandbox Code Playgroud)
然后在我的笔记本上我有两个内核python 2和python 3.在笔记本内部,我使用python3内核获得以下内容:
> import sys
> print(sys.executable)
/Users/***/miniconda3/envs/py35/bin/python
Run Code Online (Sandbox Code Playgroud)
这与python2内核:
> import sys
> print(sys.executable)
/usr/local/opt/python/bin/python2.7
Run Code Online (Sandbox Code Playgroud)
sys.executable为python2的miniconda env?source activate py35一个链接jupyter notebook吗?我想我真的错过了什么.
谢谢大家.
---编辑
我有多个jupyter bin:
> where jupyter
/usr/local/bin/jupyter
/usr/local/bin/jupyter
/Users/ThomasDehaeze/miniconda3/bin/jupyter
Run Code Online (Sandbox Code Playgroud)
我这里只有一个内核/usr/local/share/jupyter/kernels/python2.但在Jupyter里面,我有两个内核,python2而且python3.我在哪里可以找到另一个?
我修改kernel.json自/usr/local/share/jupyter/kernels/python2:
{
"display_name": "Python 2",
"language": "python", …Run Code Online (Sandbox Code Playgroud) 我是jupyter笔记本的新手,jupyter笔记本和jupyter实验室之间的关键区别是什么,建议我选择最好的笔记本,这应该在将来使用.
我刚刚在Windows 10中通过pip安装了Jupyter(Python版本为3.7.2),通过调用启动了jupyter服务器,并jupyter notebook在我的Web浏览器中创建了一个带有内核python3的新笔记本,但是从未实现与内核的连接。
在命令行中没有明显的错误:
C:\Users\xxxx>jupyter notebook
[I 21:18:21.005 NotebookApp] Serving notebooks from local directory: C:\Users\xxxx
[I 21:18:21.005 NotebookApp] The Jupyter Notebook is running at:
[I 21:18:21.006 NotebookApp] http://localhost:8888/?token=5743fcbbc805efa4b36c983a7beb63b95cf922957378d64f
[I 21:18:21.007 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 21:18:21.087 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/xxxx/AppData/Roaming/jupyter/runtime/nbserver-18416-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=5743fcbbc805efa4b36c983a7beb63b95cf922957378d64f
[I 21:18:33.777 NotebookApp] Creating new notebook in
[I 21:18:35.512 …Run Code Online (Sandbox Code Playgroud) jupyter-notebook ×10
python ×6
jupyter ×3
anaconda ×1
docker ×1
figures ×1
ipython ×1
ipywidgets ×1
jupyter-lab ×1
matplotlib ×1
miniconda ×1
pandas ×1