我试图呈现在IPython的笔记本来复杂的数学横跨在来到这个答案,这IPython的笔记本展示了丰富的显示系统(向下滚动至底部是最后一个例子),其中都提到一个的可用性%%latex细胞.但是,在尝试制作乳胶细胞时出现以下错误,
错误:
%%latex未找到单元魔术功能.
我正在运行0.13.2版,我遗失了什么?我需要以某种方式导入这个神奇的功能吗?
所以 - ROOT社区中的优秀人员产生了以下魔力:
# This is for intercepting the output of ROOT
# In a cell, put %%rootprint so that the output that would normally be
# sent directly to the stdout will instead be displayed in the cell.
# It must be the first element in the cell.
import tempfile
import ROOT
from IPython.core.magic import (Magics, magics_class, cell_magic)
@magics_class
class RootMagics(Magics):
"""Magics related to Root.
%%rootprint - Capture Root stdout output and show in result cell
"""
def __init__(self, …Run Code Online (Sandbox Code Playgroud) 我在mavericks osx上安装了anaconda.当我尝试从启动器应用程序安装ipython笔记本时 - 它显示应用程序正在安装的消息,但之后没有任何反应.启动器中的链接也不起作用,我可以轻松地从终端启动ipython笔记本.所以我觉得启动器本身有问题.
我该如何解决?
我一直在本地托管笔记本上工作一段时间没有任何问题.但是,我最近重新打开笔记本,发现我的所有单元格都重叠,如下图所示:

如果我再次上下移动细胞,它们似乎正确地重新对齐.我能想到的唯一变化可能是因为我最近更新了我的anaconda包.控制台的所有输出对我来说都是正常的.
2014-10-10 08:22:45.531 [NotebookApp] Using existing profile dir: u'/Users/uname/.ipython/profile_default'
2014-10-10 08:22:45.535 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
2014-10-10 08:22:45.726 [NotebookApp] Serving notebooks from local directory: /Users/uname/cwd
2014-10-10 08:22:45.727 [NotebookApp] 0 active kernels
2014-10-10 08:22:45.727 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2014-10-10 08:22:45.727 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
2014-10-10 08:23:00.197 [NotebookApp] Kernel started: fa1fcfaf-c04f-4af0-a8da-6199a5e1d7ca
Run Code Online (Sandbox Code Playgroud)
知道可能导致这种情况的原因吗?
系统信息:
我有一个函数createWidgets,其目的是获取字符串列表并为每个字符串创建一个容器列表 - > 1容器=一个文本框和复选框.然后将每个容器放入大容器中.
我要做的是在容器上附加一个按钮,on_click将获取所有"True"并放入所有修改过的字符串并将它们放入数据框中
widgelist = e.options
txtBox_type = 'text_widget' # Define if Area box o regular txtbox
bigContainer = createWidgets(widgelist, txtBox_type)
Function
def createWidgets(widgelist, txtBox_type):
#containerList = []
i = 0
for k in widgelist:
## Build Container widgets
chBox_Widget = widgets.CheckboxWidget(description = str(i),value = False,)
if txtBox_type == 'textA_widget': # Check wether txtBox should be an area txt box or not.
txt_Widget = widgets.TextareaWidget( description = str(i), value = k)
else:
txt_Widget = widgets.TextWidget( description = str(i), …Run Code Online (Sandbox Code Playgroud) 我有一个表示事件日志的日期时间对象列表:
[datetime.datetime(2014, 12, 16, 0, 18, 12),
datetime.datetime(2014, 12, 16, 0, 18, 27),
datetime.datetime(2014, 12, 16, 0, 18, 27),
datetime.datetime(2014, 12, 16, 0, 19, 9),
datetime.datetime(2014, 12, 16, 0, 19, 39),
datetime.datetime(2014, 12, 16, 0, 19, 49),
datetime.datetime(2014, 12, 16, 0, 20, 2),
datetime.datetime(2014, 12, 16, 0, 20, 19),
datetime.datetime(2014, 12, 16, 0, 20, 47),
...
datetime.datetime(2014, 12, 16, 6, 23, 43),
datetime.datetime(2014, 12, 16, 6, 25, 45)]
Run Code Online (Sandbox Code Playgroud)
如何创建每秒事件数量的情节?例如,价值应该是:
我试过这样的事情:
pd.Series([1 for _ in …Run Code Online (Sandbox Code Playgroud) 我正在使用iPython笔记本来测试交互功能.几个月前,以下示例(从这里开始)对我来说很好.但是,如果我现在运行它,它会绘制可能组合的所有图像.我不知道这是否是重复的,但这个并没有帮助.
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
# mpl.rcParams['figure.max_open_warning'] = 1
def plot(amplitude, color):
fig, ax = plt.subplots(figsize=(4, 3),
subplot_kw={'axisbg':'#EEEEEE',
'axisbelow':True})
ax.grid(color='w', linewidth=2, linestyle='solid')
x = np.linspace(0, 10, 1000)
ax.plot(x, amplitude * np.sin(x), color=color,
lw=5, alpha=0.4)
ax.set_xlim(0, 10)
ax.set_ylim(-1.1, 1.1)
return fig
from ipywidgets import StaticInteract, RangeWidget, RadioWidget
StaticInteract(plot,
amplitude=RangeWidget(0.1, 1.0, 0.1),
color=RadioWidget(['blue', 'green', 'red']))
Run Code Online (Sandbox Code Playgroud)
这是输出:
你能帮助我吗?
我有一个neo4j图,我想在一个带有网络x的ipython笔记本中绘制整个图形.我该怎么做呢?
像这样的东西?
g1 = nx.neo4j_graph
nx.draw(g1)
plt.show()
Run Code Online (Sandbox Code Playgroud) 我安装了IPython 4.0.1.我无法弄清楚以下错误的原因 -
>>> from IPython.html import widgets
>>> k = widgets.Box
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 90, in __getattr__
return import_item(name)
File "C:\Python34\lib\site-packages\IPython\utils\importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
ImportError: No module named 'ipywidgets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
k = widgets.Box
File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 92, in __getattr__
raise AttributeError(key)
AttributeError: Box
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我正在使用R ipython笔记本(相对R新手),并尝试使用“ bigrquery”从Google Big Query提取数据。有人告诉我这应该很简单,但是使用标准sql进行提取是行不通的。
这是我的代码:
require("bigrquery")
# Use your project ID here
project <- "project-id" # put your project ID here
standard_sql <- "SELECT year, month, day, weight_pounds FROM `publicdata.samples.natality` LIMIT 5"
legacy_sql <- "SELECT year, month, day, weight_pounds FROM [publicdata:samples.natality] LIMIT 5"
# doesn't work
standard_data <- query_exec(standard_sql, project = project, useLegacySql = FALSE)
# works
legacy_data <- query_exec(legacy_sql, project = project, useLegacySql = TRUE)
Run Code Online (Sandbox Code Playgroud)
对于上面的标准sql,它返回以下错误:
Error: Invalid table name: `publicdata:samples.natality`
Traceback:
1. query_exec(standard_sql, project = project, useLegacySql …Run Code Online (Sandbox Code Playgroud) ipython-notebook ×10
python ×6
ipython ×3
matplotlib ×3
anaconda ×2
latex ×1
neo4j ×1
networkx ×1
pandas ×1
python-2.7 ×1
r ×1
widget ×1