ipython-notebook

How do I convert a IPython Notebook into a Python file via commandline?

六月ゝ 毕业季﹏ 提交于 2019-11-28 02:31:57
I'm looking at using the *.ipynb files as the source of truth and programmatically 'compiling' them into .py files for scheduled jobs/tasks. The only way I understand to do this is via the GUI. Is there a way to do it via command line? wwwilliam If you don't want to output a Python script every time you save, or you don't want to restart the IPython kernel: On the command line , you can use nbconvert : $ jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb As a bit of a hack, you can even call the above command in an IPython notebook by pre-pending ! (used for any command line argument). Inside

Bokeh hover tooltip not displaying all data - Ipython notebook

两盒软妹~` 提交于 2019-11-28 01:21:56
问题 I am experimenting with Bokeh and mixing pieces of code. I created the graph below from a Pandas DataFrame, which displays the graph correctly with all the tool elements I want. However, the tooltip is partially displaying the data. Here is the graph: Here is my code: from bokeh.plotting import figure, show from bokeh.io import output_notebook from bokeh.models import HoverTool from collections import OrderedDict x = yearly_DF.index y0 = yearly_DF.weight.values y1 = yearly_DF.muscle_weight

ipython notebook on linux VM running matplotlib interactive with nbagg

浪尽此生 提交于 2019-11-28 01:08:37
I want buttons and other interactive matplotlib objects to appear from within my ipython notebook. Here is what I've done: Installed http://datasciencetoolbox.org , it is a vagrant box with ipython installed and version 1.3.1 of matplotlib. I needed to upgrade matplotlib to the latest version, because it has this capability to do inline interactive plots. What's new in Matplotlib 1.4.1 I needed to run sudo apt-get install pkg-config and sudo pip install matplotlib --upgrade in order to get that going. Then, in order to produce the nice (i.e. error-free) screenshot below, I went into the

iframe not rendering in ipython-notebook

左心房为你撑大大i 提交于 2019-11-28 00:22:55
问题 The following iframe will not render in an ipython-notebook from IPython.display import HTML HTML('<iframe src=http://stackoverflow.com width=700 height=350></iframe>') but, this one will render (note, .com versus .org) from IPython.display import HTML HTML('<iframe src=http://stackoverflow.org width=700 height=350></iframe>') Is there something I am doing wrong in the first example? If this is a bug, where do I submit a bug report? 回答1: You have a "Refused to display document because display

How to make Ipython output a list without line breaks after elements?

久未见 提交于 2019-11-27 23:04:36
问题 The IPython console prints a list of elements with line breaks so that each element is displayed in its own line. This is usually a feature, but in my case it is a bug: I need to copy and paste long lists, so I need a compact representation. How can I achieve this? 回答1: You can use %pprint command to turn on/off pprint feature: In [1]: range(24) Out[1]: [0, 1, 2, ... 21, 22, 23] In [2]: %pprint Pretty printing has been turned OFF In [3]: range(24) Out[3]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

Automatically including jars to PySpark classpath

邮差的信 提交于 2019-11-27 21:02:08
问题 I'm trying to automatically include jars to my PySpark classpath. Right now I can type the following command and it works: $ pyspark --jars /path/to/my.jar I'd like to have that jar included by default so that I can only type pyspark and also use it in IPython Notebook. I've read that I can include the argument by setting PYSPARK_SUBMIT_ARGS in env: export PYSPARK_SUBMIT_ARGS="--jars /path/to/my.jar" Unfortunately the above doesn't work. I get the runtime error Failed to load class for data

matplotlib python inline on/off

巧了我就是萌 提交于 2019-11-27 20:21:47
If I start an ipython notebook with matplotlib inlined, is there a way to subsequently plot a figure so that it shows in the "standard", non-inlined, way, without having to reload the notebook without the inline command? I'd like to be able to have some figures inlined int he notebook, but others in the traditional interactive mode, where I can zoom and pan. You can switch the matplotlib's backend by %matplotlib <backend> . To switch back to your system's default backend use %matplotlib auto or just simply %matplotlib . There are many backends available such as gtk , qt , notebook , etc. I

Automatically play sound in IPython notebook

巧了我就是萌 提交于 2019-11-27 20:20:08
问题 I often run long-running cells in my IPython notebook. I'd like the notebook to automatically beep or play a sound when the cell is finished executing. Is there some way to do this in iPython notebook, or maybe some command I can put at the end of a cell that will automatically play a sound? I'm using Chrome if that makes any difference. 回答1: TL;DR At the top of your notebook from IPython.display import Audio sound_file = './sound/beep.wav' sound_file should point to a file on your computer,

How do I add a kernel on a remote machine in IPython (Jupyter) Notebook?

痞子三分冷 提交于 2019-11-27 20:08:44
Dropdown menu in the top-right of the UI on a local machine (PC): Kernel-> Change kernel-> Python 2 (on a local PC) Python 3 (on a local PC) My new kernel (on a remote PC) IPython use kernel is a file in ~/.ipython/kernel/<name> that describe how to launch a kernel. If you create your own kernel (remote, or whatever) it's up to you to have the program run the remote kernel and bind locally to the port the notebook is expected. The IPython notebook talks to the kernels over predefined ports. To talk to a remote kernel, you just need to forward the ports to the remote machine as part of the

Is there a way to run multiple cells simultaneously in IPython notebook?

我的梦境 提交于 2019-11-27 19:58:40
One cell in my notebook executes for a long time, while the other CPU's in the machine are idle. Is it possible to run other cells in parallel? Not magically, and probably not what you think but yes. Here is the documentation for ipyparallel (formerly IPython parallel ) that will show you how to spawn multiple IPython kernel. After you are free to distribute the work across cores, and you can prefix cells with %%px0 %%px1 ... %%px999 (once set up) to execute a cell on a specific engine, which in practice correspond to parallel execution of cell. I woudl suggest having a look as Dask as well.