ipython

Why does %timeit loop different number of times?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:48:13
问题 On Jupter Notebook, i was trying to compare time taken between the two methods for finding the index with max value. In the Image, the first function took, 1000 loops, and the second took 10000 loops, is this increase in loops due to the method itself OR Jupyter Just added more loops to get more accurate time per loop even though the second function maybe took 1000 only, is that the case? 回答1: %timeit library will limit the number of runs depending on how long the script takes to execute. The

iPython notebook won't upgrade, always runs in v. 0.12

我们两清 提交于 2019-12-10 12:06:35
问题 I've had some issues with iPython notebook since installing it for the first time. I already had installed iPython via pip install, but then I decided to install Canopy Express to get all the packages and a easy-to-use package manager. I am on a MBP with latest Yosemite installed. When I run ipython notebook via. ipython notebook --pylab inline in a terminal, notebook starts up fine in Chrome. But, then i check the version of iPython with import IPython IPython.__version__ it says 0.12 --

How to paste examples into IPython?

空扰寡人 提交于 2019-12-10 11:34:38
问题 The web is full with python code examples that are either taken from vanila Python shell >>> for i in range(10): ... print(i) ... .... or from IPython shell: In [1]: for i in range(10): ...: print(i) ...: print(i + 1) ...: When I want to paste such snippets into IPython, I need to paste them into a text editor, do some find-and-replace and then paste it into IPython. I'm sure there is a better way, but can't find it. 回答1: In IPython you can call %paste it will paste your clipboard in terminal

Are unicode identifiers in python bad practice?

旧城冷巷雨未停 提交于 2019-12-10 10:58:24
问题 I am getting into machine learning, and to document my code, I will write LaTeX math versions of my functions, right next to the code in an Jupyter/IPython notebook. The mathematical definitions include many Greek symbols, so I thought that I might as well use the Greek symbols in function and variable names, since that's possible in python. Would this be bad practice? 回答1: It seems a good use case under these assumptions: the audience is mathematically versed, you make use of a lot of

Awk print with pipes not working iPython in Jupyter Notebook

我的梦境 提交于 2019-12-10 10:54:55
问题 So the command below does not give me any output in Jupyter Notebook with iPython: IP = '62.172.72.131' !cat hits.csv | grep {IP} | awk '{print $1}' I have tried both double and single "$" sign and none of them works. If I only use one pipe in the command, it works fine. For example: IP = '62.172.72.131' !cat hits.csv | grep {IP} !cat hits.csv | awk '{print $1}' Anyone know why this is happening? Thanks! 回答1: I think I figured this out. The "$" and "{" and "}" are all special characters in

IPython buffer and pagination in Enthought Canopy

若如初见. 提交于 2019-12-10 10:53:22
问题 I'm using Enthought's beta distribution of Python Canopy 0.9.1 on Windows 7. How do I increase the size of my IPython buffer. Also how do I pipe the output of a command through a paginator; output is currently unpaginated. If existing answers like How to increase the ipython qtconsole scrollback buffer limit or How to use Pipe in ipython will work, I don't know how to apply them to Windows. Thank you! 回答1: There's currently no preference or config option to increase the buffer limit currently

Make ipython always execute command when I press return key?

谁说我不能喝 提交于 2019-12-10 10:49:33
问题 After migrating to ipython, I noticed that sometimes return key causes a line break instead of executing the command. For example if I have my cursor before ) in print() , it would result in: print( ) How can I make it just run print() in this and other cases? 回答1: This happens when you are in multiline mode, e.g. In [200]: for i in range(3): ...: print(i) ...: You either need to move to the end of the block ( <end> ) and return twice (or more if editing has accumulated a bunch of blank lines

Messaging and Jupyter Notebooks

ぃ、小莉子 提交于 2019-12-10 10:46:27
问题 I'm trying to wrap my head around messaging in Jupyter notebooks. But I'm a bit lost and confused. My goal is fairly straight forward to state: I want my python kernel to update the output of a cell in a Jupyter notebook while a long calculation is running. Whenever new data arrives in the browser, I want to trigger a redraw by calling some javascript function. Specifically, the cell output contains HTML with a WebGL canvas. That part works well. I can easily visualize the initial data in the

Open IPython Notebook 2.7 and 3.4 in Parallel

瘦欲@ 提交于 2019-12-10 10:41:50
问题 I've searched through SO, but haven't found a clear answer to what I'm trying to do. If the answer already exists, I'd appreciate a pass-along of the URL. For reference: I'm new to running multiple Python versions, and can run code through both interpreters. I'm on Windows 7, and used the anaconda distribution. In my cmd , I've activated Python2.7 as default. To access Python2.7 and Python3.4, I use python and py -3 respectively. I'd like to be able to open IPython browser notebooks for 2.7

Jupyter Notebook Set Default Folder to Root

人走茶凉 提交于 2019-12-10 10:26:59
问题 I am using Jupyter Notebook on Windows 7, and I want to set the default foler to D: . Currently, I have the following line in my jupyter_notebook_config.py: c.NotebookApp.notebook_dir = 'D:/' When I open Jupyter Notebook, in the browser I receive the following message: 404 : Not Found You are requesting a page that does not exist! In the prompt, I get the following output: [W 14:12:45.477 NotebookApp] ipywidgets package not installed. Widgets are unavailable. [I 14:12:45.497 NotebookApp]