当我想在我的macbook上运行ipython notebook时,我收到以下错误.有谁知道如何解决这一问题?你能帮我解决一下吗?
ERROR:root:Exception in I/O handler for fd 6
Traceback (most recent call last):
File "//anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 346, in start
self._handlers[fd](fd, events)
File "//anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 167, in accept_handler
callback(connection, address)
File "//anaconda/lib/python2.7/site-packages/tornado/tcpserver.py", line 217, in _handle_connection
do_handshake_on_connect=False)
File "//anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 407, in ssl_wrap_socket
return ssl.wrap_socket(socket, **dict(context, **kwargs))
File "//anaconda/python.app/Contents/lib/python2.7/ssl.py", line 387, in wrap_socket
ciphers=ciphers)
File "//anaconda/python.app/Contents/lib/python2.7/ssl.py", line 141, in __init__
ciphers)
SSLError: [Errno 336445449] _ssl.c:368: error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib
ERROR:root:Exception in I/O handler for fd 6
Traceback (most recent call last): …Run Code Online (Sandbox Code Playgroud) 我正在尝试从文件菜单(在2.0中添加好的功能)将笔记本转换为html,但是当我这样做时,出现500:Internal Server Error屏幕,显示以下文本:
nbconvert failed: Pandoc wasn't found.
Please check that pandoc is installed:
http://johnmacfarlane.net/pandoc/installing.html
Run Code Online (Sandbox Code Playgroud)
我已经使用Windows Installer从链接中安装了Pandoc,但仍然收到相同的错误。对于如何解决这个问题,有任何的建议吗?我需要将刚刚下载的Pandoc文件夹或pandoc.exe放在哪里才能使此工作正常进行?
在Windows 7上运行IPython Notebook时,我遇到以下异常.这似乎是一个安装问题.
ERROR:root:Exception in I/O handler for fd 644
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\zmq\eventloop\ioloop.py", line 340, in start
self._handlers[fd](fd, events)
KeyError: 644
Run Code Online (Sandbox Code Playgroud) 我正在研究以下类型的数据.
itemid category subcategory title
1 10000010 ????????? ?????????? ? ???????? Toyota Sera, 1991
2 10000025 ?????? ??????????? ????? ?????? ??????
3 10000094 ?????? ???? ??????, ?????, ?????????? ?????? Steilmann
4 10000101 ????????? ?????????? ? ???????? Ford Focus, 2011
5 10000132 ????????? ???????? ? ?????????? ??????? 3.0 Bar
6 10000152 ????????? ?????????? ? ???????? ??? 2115 Samara, 2005
现在我运行以下命令
import pandas as pd
trainingData = pd.read_table("train.tsv",nrows=10, header=0,encoding='utf-8')
trainingData['itemid'].head()
0 10000010
1 10000025
2 10000094
3 10000101
4 10000132
Name: itemid … 我正在使用IPython 2.7。我希望打印最后的3或5或一般的'n'命令。该%hist命令将打印到目前为止的所有命令。请注意,此处的“ n”不是行号(即IPython对每行的索引)。
我想为Ipython笔记本使用另一个主题,所以我按照这个说明问题是我在OSX中,我没有wget,我安装了自制软件.有人可以帮我设置一个黑暗主题的ipython笔记本吗?我试过这个:
brew /Users/user/.ipython/profile_notebooks/static/custom/custom.css
https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css
Run Code Online (Sandbox Code Playgroud) 我想在代码的最后一行上每隔一定间隔(1000)之后打印一个值,而不是每个单个值。
DARTS=200000
hits = 0
throws = 0
rangen = RanGenerator()
pi = 0
avg = 0
mu = 0
var = 0
dev = 1
for i in range (1, DARTS):
throws += 1
x = rangen.rand()
y = rangen.rand()
z = rangen.rand()
tt = x**2 + y**2 + z**2
dist = sqrt(tt)
if dist <= 1.0:
hits = hits + 1.0
pi = 6 * (hits / throws)
avg = avg + pi
mu = avg/throws
var = …Run Code Online (Sandbox Code Playgroud) 我的问题是:如何编写可以访问IPython笔记本命名空间的IPython单元魔术?
IPython允许编写用户定义的单元格魔术.我的计划是创建一个绘图函数,它可以绘制一个或多个任意Python表达式(基于Pandas Series对象的表达式),其中单元格字符串中的每一行都是图表中的单独图形.
这是细胞魔法的代码:
def p(line, cell):
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame()
line_list = cell.split('\n')
counter = 0
for line in line_list:
df['series' + str(counter)] = eval(line)
counter += 1
plt.figure(figsize = [20,6])
ax = plt.subplot(111)
df.plot(ax = ax)
def load_ipython_extension(ipython):
ipython.register_magic_function(p, 'cell')
Run Code Online (Sandbox Code Playgroud)
该函数以字符串形式接收整个单元格内容.然后,该字符串由换行符拆分,并使用eval()进行评估.结果将添加到Pandas DataFrame中.最后,使用matplotlib绘制DataFrame.
用法示例:首先在IPython笔记本中定义Pandas Series对象.
import pandas as pd
ts = pd.Series([1,2,3])
Run Code Online (Sandbox Code Playgroud)
然后在IPython笔记本中调用魔法(下面的整个代码是一个单元格):
%%p
ts * 3
ts + 1
Run Code Online (Sandbox Code Playgroud)
此代码失败,并显示以下错误:
NameError: name 'ts' is not defined
Run Code Online (Sandbox Code Playgroud)
我怀疑问题是该p函数只接收ts * …
第一次尝试散景.使用bokeh.pydata.org中的以下示例代码:
from collections import OrderedDict
from bokeh.charts import Scatter
from bokeh.sampledata.iris import flowers
output_notebook()
Run Code Online (Sandbox Code Playgroud)
在iPython(Anaconda,py 3.4,Win 7)中,收到以下错误:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-2-c57c6fa8f51a> in <module>()
----> 1 output_notebook()
NameError: name 'output_notebook' is not defined
Run Code Online (Sandbox Code Playgroud)
为什么?这是直接的例子.
我有一个使用pyinstaller构建的应用程序,它使用PySide作为其Qt Gui.我通过嵌入ipython qtconsole包含了一个交互式提示.这打破了pyinstaller创建的构建.
这是一个最小(非)工作的例子:
from PySide.QtGui import *
from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
from IPython.qt.inprocess import QtInProcessKernelManager
from IPython.lib import guisupport
class IPythonWidget(RichIPythonWidget):
def __init__(self, parent=None, **kwargs):
super(self.__class__, self).__init__(parent)
self.app = app = guisupport.get_app_qt4()
self.kernel_manager = kernel_manager = QtInProcessKernelManager()
kernel_manager.start_kernel()
self.kernel = kernel = kernel_manager.kernel
kernel.gui = 'qt4'
self.kernel_client = kernel_client = kernel_manager.client()
kernel_client.start_channels()
if __name__ == '__main__':
app = QApplication([])
i = IPythonWidget()
i.show()
app.exec_()
Run Code Online (Sandbox Code Playgroud)
当直接从源(python mwe.py)运行时,它弹出一个ipython qt控制台窗口.当我在一个目录中使用pyinstaller捆绑这个并运行exe时,我得到这个:
Traceback (most recent call last):
File "<string>", line 3, in <module>
File …Run Code Online (Sandbox Code Playgroud) ipython ×10
python ×7
python-2.7 ×2
anaconda ×1
bokeh ×1
certificate ×1
html ×1
macos ×1
pandoc ×1
pyinstaller ×1
pyside ×1
python-3.x ×1
subprocess ×1
ubuntu ×1