当我在IPython Notebook上进行数据分析时,我经常感到需要向上或向下移动几个相邻的输入单元,以便更好地分析故事.
我曾预计,一旦我创建了一个标题,如果我移动标题,那个标题下的所有单元格都会一起移动.但这种情况并非如此.
我能做到这一点吗?
编辑:为了澄清,我当然可以单独移动单元格,键盘快捷键很方便; 但我正在寻找的是一种分组单元格的方法,这样我就可以将它们一起移动(甚至删除).
一旦我用Jupyter打开一个笔记本文件(它要求我转换文件),我再也不能在标准的IPython笔记本中打开它了.我收到以下错误:
Error loading notebook
Bad Request
2014-12-21 04:13:03.203 [NotebookApp] WARNING | Unreadable Notebook: /FunIT experiment.ipynb global name 'NBFormatError' is not defined
WARNING:tornado.access:400 GET /api/notebooks/FunIT%20experiment.ipynb?_=1419153182928 (::1) 3.11ms referer=http://localhost:8888/notebooks/FunIT%20experiment.ipynb
Run Code Online (Sandbox Code Playgroud)
此类损坏文件的示例如下:https: //www.dropbox.com/s/7io99wpoivxmc8f/FunIT%20experiment.ipynb?dl=0
我该如何恢复这个过程?我需要使用标准的IPython笔记本(v2.2.0)打开这些文件.
平台:redhat x64,通过pyvenv-3.4安装ipython notebook 3.0
当我打开笔记本时,它总是显示"内核启动,请稍候......".但我可以打开IPython控制台.
请帮忙,谢谢!
我想打印到运行IPython Notebook的终端窗口而不是单元格输出.当我发出大量print呼叫时,打印到单元输出会消耗更多内存并减慢我的系统速度.从本质上讲,我想通过设计这种行为.
我尝试过以下方法:
是否可以编写一个Jupyter笔记本,以便参数可以通过笔记本的URL传入?
例如,对于这样的URL:
http://jupyter.example.com/user/me/notebooks/notebook1.ipynb?Variable1=Value1&Variable2=Value2
Run Code Online (Sandbox Code Playgroud)
如何可以访问Variable1,并Variable2在Jupyter细胞内?
我有一个格式很好的ipython笔记本,配有markdown单元格和诸如此类的东西.我想知道在导出到PDF文件方面我的选择是什么.
到目前为止,我一直在File > Print View使用chrome的"保存到文件"功能将结果页面打印为PDF.这在技术上有效,但它有一个主要的不便之处:我的数字,代码和降价单元通常被分页符分开.
有没有其他的解决方案可以让我有一个连续的PDF文件?
编辑: 我遇到了nbconvert,但当我不断收到"找不到文件"错误.有人跟nbconvert有什么运气吗?该文档声称支持导出为PDF,但是当我运行时nbconvert.py -f pdf,错误消息表明实际上并不支持PDF格式.
出于教学目的,我想要一个IPython笔记本显示(作为单元格的输出)功能源代码,但我希望能够在多个笔记本中引用它.因此,我希望以类似于使用%psource魔术的方式显示功能代码,但会突出显示适当的语法.
这是与此问题类似的问题,但我希望能够将其应用于文件中的单个函数,而不是一次性应用于完整文件.
使用上一个问题的建议我破解了一个简单的短代码:
def print_source(module, function):
"""For use inside an IPython notebook: given a module and a function, print the source code."""
from inspect import getmembers, isfunction, getsource
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
from IPython.core.display import HTML
internal_module = __import__(module)
internal_functions = dict(getmembers(internal_module, isfunction))
return HTML(highlight(getsource(internal_functions[function]), PythonLexer(), HtmlFormatter(full=True)))
Run Code Online (Sandbox Code Playgroud)
两个问题:
我有两个情节,我想与ipython笔记本小部件进行交互.下面的代码是我正在尝试做的简化示例.
import matplotlib.pyplot as plt
import IPython.html.widgets as wdg
def displayPlot1(rngMax = 10):
plt.figure(0)
plt.plot([x for x in range(0, rngMax)])
wdg1 = wdg.interactive(displayPlot1, rngMax = wdg.IntSlider(20))
def displayPlot2(rngMax = 10):
plt.figure(1)
plt.plot([x**2 for x in range(0, rngMax)])
wdg2 = wdg.interactive(displayPlot2, rngMax = wdg.IntSlider(10))
wdg.ContainerWidget([wdg.HTML("""<h1>First Plot</h1>"""),
wdg1,
wdg.HTML("""<h1>Second Plot</h1>"""),
wdg2])
Run Code Online (Sandbox Code Playgroud)
第一个问题是它首先显示所有小部件,最后一个接一个地显示两个小部件:
title1
widget1
title2
widget2
plot1
plot2
Run Code Online (Sandbox Code Playgroud)
我想:
title1
widget1
plot1
title2
widget2
plot2
Run Code Online (Sandbox Code Playgroud)
此外,当我触摸任何滑块时,整个输出似乎都会被覆盖,并且只显示一个图(我正在改变的图).
我该如何解决这个问题?(如果我将它们分成两个不同的单元格,我可能会这样做,但是我打算做一些更复杂的事情,最终需要在一个单元格中)
我目前正在尝试制作python教程并使用Heroku网站上的ipython笔记本托管它们.问题是ipython笔记本在上传时是静态的.我试图让用户可以交互使用笔记本电脑(如打印输出).我也不希望他们的笔记本电脑的输出永久保存在Heroku网站上.
在渲染降价单元格时,在乳胶部分之后显示垂直条.有没有办法删除这些?
例如,markdown单元格中的以下代码:
$\left[ \begin{array}{cccc}
x_{11} & x_{12} & \ldots & x_{1D} \\
x_{21} & x_{22} & \ldots & x_{2D} \\
x_{31} & x_{32} & \ldots & x_{3D} \\ \end{array} \right]$
Run Code Online (Sandbox Code Playgroud)
呈现为
和
$\mathbf{W} \in \mathbb{R}^{D\times K}$
Run Code Online (Sandbox Code Playgroud)
呈现为
Mac OS 10.10.5
chrome 48.0.2564.48(Official Build)beta(64位)
ipython notebook --version 4.0.6
ipython-notebook ×10
python ×7
ipython ×5
python-3.x ×2
heroku ×1
jupyter ×1
python-2.7 ×1
python-3.4 ×1
redhat ×1
windows ×1