ipython

Jupyter: disable restart kernel warning

£可爱£侵袭症+ 提交于 2019-12-22 04:07:57
问题 I'm using jupyter 4.1.0, and I find myself making frequent use of the "Restart & Run All" feature. Every time I use that button it displays this warning: Is there a way to disable that warning? 回答1: You can add a cell in your notebook and using the following statements: from IPython.core.display import HTML HTML("<script>Jupyter.notebook.kernel.restart()</script>") And the kernel will restart immediately. 来源: https://stackoverflow.com/questions/37472274/jupyter-disable-restart-kernel-warning

Can I display an Ipython notebook hosted on bitbucket?

倾然丶 夕夏残阳落幕 提交于 2019-12-22 04:05:39
问题 I have a very simple notebook, hosted on github and on bitbucket. The github URL displays fine in the nbviewer, but the bitbucket URL - which should indicate the same trivial notebook - does not work with the nbviewer. Is it possible that nbviewer only takes github notebooks? Later comment: my repo was private - so that was at least one reason why it could not work! 回答1: Since this is/was the first result when googling for this, I just thought I'd update and let everyone know that this is now

Can I display an Ipython notebook hosted on bitbucket?

China☆狼群 提交于 2019-12-22 04:05:29
问题 I have a very simple notebook, hosted on github and on bitbucket. The github URL displays fine in the nbviewer, but the bitbucket URL - which should indicate the same trivial notebook - does not work with the nbviewer. Is it possible that nbviewer only takes github notebooks? Later comment: my repo was private - so that was at least one reason why it could not work! 回答1: Since this is/was the first result when googling for this, I just thought I'd update and let everyone know that this is now

how to print source code of object I defined use %edit magic

本小妞迷上赌 提交于 2019-12-22 03:32:40
问题 Ipython 0.13.1 can print the source of an object from python library, such as, os.path.abspath?? But I can't print the source code of any object I defined through %ed magic in ipython, Is anything wrong I did? such as, I define a class Name through %ed magic: %ed then class Name(object): """docstring for Name""" name = 'hong' def __init__(self, arg): super(Name, self).__init__() self.arg = arg def pri(): print 'class Name' when back to ipython, I can't see the source code of class Name: In

How to show function parameters in IPython?

元气小坏坏 提交于 2019-12-22 03:21:52
问题 I read that pressing shift+tab after a function displays the function's docstring in an IPython notebook, but this does not seem to work in my IPython (no notebook). I run IPython 4.0.0 on Ubuntu. Any suggestion? 回答1: The standard (console) IPython does not support the call tips via <shift> + <tab> . But a question mark before or after the function shows you the docstring: In [1]: list.index? Docstring: L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises

Plotting a histogram given bin endpoints and values

前提是你 提交于 2019-12-21 22:08:29
问题 Say I have an array of bin edges, and an array of bin values. (basically the output of plt.hist ). For instance: bins = np.array([1, 2, 3, 4, 5]) vals = np.array([2, 5, 5, 2]) How do I plot this as a histogram? Edit: for clarity, I mean vals to be the "height" of each bin, where len(vals) + 1 = len(bins) 回答1: If you are using python 3.5 you can use pyplot fill_between function for such. You can use following code: import numpy as np import matplotlib.pyplot as plt bins = np.array([1, 2, 3, 4,

Is it possible to pass a variable out of a pdb session into the original interactive session?

做~自己de王妃 提交于 2019-12-21 20:49:57
问题 I am using pdb to examine a script having called run -d in an ipython session. It would be useful to be able to plot some of the variables but I need them in the main ipython environment in order to do that. So what I am looking for is some way to make a variable available back in the main interactive session after I quit pdb. If you set a variable in the topmost frame it does seem to be there in the ipython session, but this doesn't work for any frames further down. Something like export in

ipython安装

℡╲_俬逩灬. 提交于 2019-12-21 20:15:33
IPython 是一个 python 的交互式 shell,支持补全等等一些强大的功能; IPython 为交互式计算提供了一个丰富的架构,包含: 强大的交互式 shell Jupyter 内核 交互式的数据可视化工具 灵活、可嵌入的解释器 易于使用,高性能的并行计算工具 我的环境是在电脑上已经安装过了Python3.6,然后在此基础上安装ipython; 1、cmd-->打开Windows命令行,--》确保电脑已经成功安装了python,输入命令python查看当前python是否已经成功安装,然后exit()退出; 2、输入命令:pip install ipython[all] 安装ipython,也可以是用pip3命令安装,此方式进行下载安装ipython,然后会自动连接ipython的网站进行下载安装,等待即可; 3、如果提示pip的版本不是最新的,此时输入命令 python -m pip install --upgrade pip 更新我们的pip就可以了; 4、安装成功以后,输入命令 ipython notebook就可以开始用了,浏览器会自动打开jupyter的页面, 在jupyter里面执行命令用:shift+enter; pip(pip3) install urllib3 (安装IPython Notebook的依赖) pip (pip3) install

What is the best way to install python 2 on OS X?

扶醉桌前 提交于 2019-12-21 19:28:43
问题 A colleague of mine wants to use my python 2 code on his OS X (10.6) machine. My code imports several built-in python packages, including Tkinter and shelve, and also uses third-party packages, including numpy, scipy, matplotlib, and ipython. I've encountered a few problems with OS X's built-in python. (IDLE doesn't work, for example*). I suspect I should install a more recent version of python, and a different version of Tk. My questions: Will having two different versions of python/Tk on

Difference in GLM results between iPython and R

∥☆過路亽.° 提交于 2019-12-21 18:08:10
问题 I'm trying to get to grips with performing regression analyses in R. Below is some random dummy data that I have generated in R, run a logistic glm in R. I have saved the data into a test file, read that into python with ipython (ipython notebook is awesome btw, only just started using it!), and then tried to run the same analyis with python. The results are very similar but they are different. I kind of would have expected them to be the same. Have I done something wrong, is there a