问题标签 [jupyter-notebook]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
11 回答
1235064 浏览

python - 如何使 IPython 笔记本 matplotlib 绘图内联

我正在尝试在带有 Python 2.7.2 和 IPython 1.1.0 的 MacOS X 上使用 IPython 笔记本。

我无法让 matplotlib 图形内联显示。

我也尝试%pylab inline过 ipython 命令行参数--pylab=inline,但这没有区别。

而不是内联图形,我得到这个:

matplotlib.get_backend()表明我有'module://IPython.kernel.zmq.pylab.backend_inline'后端。

0 投票
5 回答
37354 浏览

jupyter-notebook - 如何从另一个 ipython-notebook 导入?

我想从另一个 ipython-notebook 导入一个函数。说,

common_func.ipnbdef func_a()

当我创建一个新笔记本时,如何访问func_a来自另一个笔记本但在同一个文件夹和同一个 ipython 实例中的笔记本?

0 投票
9 回答
226679 浏览

jupyter-notebook - 如何在 Markdown 单元格 ipython/jupyter 笔记本中更改颜色?

我只是想在一个单元格中格式化一个特定的字符串。我将该单元格的格式更改为“Markdown”,但我不确定如何更改单个单词的文本颜色。

我不想改变整个笔记本的外观(通过 CSS 文件)。

0 投票
1 回答
1201 浏览

matplotlib - iPython notebook: How to prevent from outputting image on imshow()?

I use iPython notebook a lot together with matplotlib and whilst there are lots of cases when I am happy it automatically displays the images when I call imshow() there are moments when I would like to prevent that behavior.

Specifically I am looping over a very large array and generate a figure in matplotlib for each element which should be saved to disk. As part of that figure creation I have to call imshow() to draw an existing image (in my case the screenshot of a map) to the axis to later on draw additional material on top of that. Whenever I call imshow as part of the process the final figure is displayed inline in iPython notebook, how can I prevent that?

My code looks something like this:

0 投票
4 回答
32533 浏览

python - 在 Pandas 表中插入链接

我想在 Pandas 表中插入一个链接(到网页),所以当它显示在IPython笔记本中时,我可以点击该链接。

我尝试了以下方法:

但 URL 仅显示为文本。

我还尝试使用 IPython HTML 对象:

但它只会显示对象的repr。

还有其他想法吗?


alko 得到了正确的答案。我只是想补充一点,默认情况下单元格宽度是有限的,长HTML代码将被截断,即:

会变成这样:

并且不会正确显示。(即使文本 xxx 很短并且可以放入单元格中。)

我通过设置绕过它:

0 投票
2 回答
1819 浏览

jupyter-notebook - IPython 笔记本中的散景缺失图

维护者注意:这个问题已经过时了。figure在自动组合上调用多个字形方法(并且已经使用了很多年)。有关现代散景的信息,请参阅:

https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html



过时的:

我正在 IPython 笔记本中运行 Bokeh 教程。它只显示散点图而不显示折线图。从命令行它分别呈现两个图。

如何在同一个图表中将两个图表放在一起?

0 投票
4 回答
46201 浏览

python - 如何通过 sympy 在 ipython notebook 中漂亮地打印?

我试过pprint, print,前者只打印 Unicode 版本,后者不做漂亮的打印。

0 投票
6 回答
365831 浏览

python - 如何将文本文件 (.py) 加载/编辑/运行/保存到 IPython 笔记本单元格中?

我最近开始使用 IPython 笔记本作为我工作流程的一部分。但是,我没有成功找到一种方法将 .py 文件导入到打开的 IPython 笔记本的各个单元格中,以便它们可以编辑、运行然后保存。这可以做到吗?

我在文档中找到了这个,它告诉我如何将 .py 文件作为新笔记本导入,但这没有达到我想要实现的目标。

任何建议将不胜感激。

0 投票
11 回答
176976 浏览

jupyter-notebook - 如何将目录添加到 Jupyter / JupyterLab 笔记本?

http://ipython.org/ipython-doc/stable/interactive/notebook.html上的文档说

您可以使用不同级别的标题为整个计算文档提供概念结构;共有 6 个级别,从 1 级(顶层)到 6 级(段落)。这些可以在以后用于构建目录等。

但是,我在任何地方都找不到关于如何使用我的分层标题来创建这样一个目录的说明。有没有办法做到这一点?

注意:如果有的话,我也会对使用 ipython 笔记本标题的其他类型的导航感兴趣。例如,从一个标题到另一个标题来回跳转以快速找到每个部分的开头,或者隐藏(折叠)整个部分的内容。这是我的愿望清单——但任何类型的导航都会引起人们的兴趣。谢谢!

0 投票
4 回答
5970 浏览

jupyter-notebook - ipython notebook 的 TOC 扩展发生了什么?

我正在尝试在新计算机上安装出色的目录扩展。但我再也找不到了。我找到的唯一页面没有解释如何在 Windows 上安装扩展。

那么..我该如何安装它,为什么它不是官方 Ipython 笔记本的一部分?我简直无法理解没有它人们是如何相处的。