ipython-notebook

How can I block comment code in the IPython notebook?

守給你的承諾、 提交于 2019-12-03 02:40:40
问题 I have defined a function in an IPython notebook and would like to be able to block comment a section of it. Intuitively, I'd expect to be able to highlight a section of code, right click and have an option to comment out the selection but this has not been implemented. Is there a way to do this? 回答1: Default solution In IPython 2.x and 3.x (cmd|ctrl)-/ works but requires an english (american) keyboard layout, see https://github.com/ipython/ipython/pull/3673. Other keyboard layouts In case

Turn off auto-closing parentheses in ipython

送分小仙女□ 提交于 2019-12-03 02:31:20
问题 I stay up-to-date with ipython's dev branch (because ipython is pretty much the most awesome thing ever). Fairly recently (before yesterday's awesome ipython 2.0 release) I noticed that it has started to automatically close parentheses, brackets, quotes, etc., as I type them. It happens in both terminal [nothing else I use in terminal does it] and notebook sessions, so I assume it was an intentional choice on the part of the developers. I can respect that other people might like this feature,

How can I play a local video in my IPython notebook?

房东的猫 提交于 2019-12-03 02:20:14
问题 I've got a local video file (an .avi, but could be converted) that I would like to show a client (ie it is private and can't be published to the web), but I can't figure out how to play it in IPython notebook. After a little Googling it seems that maybe the HTML5 video tag is the way to go, but I don't know any html and can't get it to play. Any thoughts on how I can embed this? 回答1: ( updated 2019, removed unnecessarily costly method ) Just do: from IPython.display import Video Video("test

How does one change color in markdown cells ipython/jupyter notebook?

给你一囗甜甜゛ 提交于 2019-12-03 01:48:48
问题 I'm only looking to format a specific string within a cell. I change that cell's format to "Markdown" but I'm not sure how to change text color of a single word. I don't want to change the look of the whole notebook (via a CSS file). 回答1: You can simply use raw html tags like foo <font color='red'>bar</font> foo Be aware that this will not survive a conversion of the notebook to latex. As there are some complaints about the deprecation of the proposed solution. They are totally valid and

Ipython Notebook: where is jupyter_notebook_config.py in Mac?

…衆ロ難τιáo~ 提交于 2019-12-03 01:48:35
I just started using a Mac, so please forgive me if this sounds too naive. I'm trying to install Interactive Parallel . From https://github.com/ipython/ipyparallel , it says I need to find jupyter_notebook_config.py . I've already installed python and related packages with Anaconda , and I can use the ipython notebook. But when I search with spotlight for jupyter_notebook_config.py , I just can't find this file: So, where can I find this file? UPDATE: this is my home folder: There is only anaconda . rkrzr Look in your home directory for a .jupyter folder. It should contain the file according

How to enable line wrapping in ipython notebook

谁说我不能喝 提交于 2019-12-03 01:46:37
I have been trying to enable line wrapping in ipython notebook. I googled it with no results and i typed ipython notebook --help in a terminal. This gives me a ton of configuration commands for a config file, but no line wrapping. Does anyone know if ipnotebook has this feature and if so how to enable it? Your help would be greatly appreciated. Thank you. Jakob As @Matt pointed out you have to configure CodeMirror to enable wrapping. However, this can be achieved by simply adding the following line to your custom.js : IPython.Cell.options_default.cm_config.lineWrapping = true; So there is no

Changing browser for IPython Notebook from system default

Deadly 提交于 2019-12-03 01:45:16
I would like to keep firefox as my system default browser on my Mac, but launch IPython Notebook in Chrome [1] . This answer led me to my ipython_notebook_config.py file but I can't get an instance of Chrome running. After c = get_config() and import webbrowser , I've tried: webbrowser.register(u'chrome', None, webbrowser.Chrome()) webbrowser.register(u'chrome', webbrowser.Chrome) webbrowser.register(u'chrome', None, webbrowser.GenericBrowser('/Applications/Browsers/Chrome.app')) webbrowser.register(u'chrome', None, webbrowser.GenericBrowser('/Applications/Browsers/Chrome.app/Contents/MacOS

Can I access python variables within a `%%bash` or `%%script` ipython notebook cell?

走远了吗. 提交于 2019-12-03 01:18:14
问题 Is there a way to access variables in the current python kernel from within a %%bash or other %%script cell? Perhaps as command line arguments or environment variable(s)? 回答1: Python variables can be accessed in the first line of a %%bash or %%script cell, and so can be passed as command line parameters to the script. For example, with bash you can do this: %%bash -s "$myPythonVar" "$myOtherVar" echo "This bash script knows about $1 and $2" The -s command line option allows you to pass

plot() doesn't work on IPython notebook

此生再无相见时 提交于 2019-12-03 01:17:57
I'm new to python scientific computing, and I tried to make a simple graph on IPython notebook. import pandas plot(arange(10)) Then error had shown as below. --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-2-6b139d572bd6> in <module>() 1 import pandas ----> 2 plot(arange(10)) NameError: name 'plot' is not defined Instead, with IPython --pylab mode, a right graph popped up when I tried the same code. Am I missing any environment? My environment is Mac OSX 10.8.5, python 2.7.5, IPython 1.1.0, matplotlib 1.3.1,

How To Get IPython Notebook To Run Python 3?

放肆的年华 提交于 2019-12-03 00:44:08
问题 I am new to Python to bear with me. I installed Anaconda, works great. I setup a Python 3 environment following the Anaconda cmd line instructions, works great. I setup Anaconda's Python 3 environment as Pycharm's interpreter, works great. I launched the Anaconda "launcher.app" and launched IPython Notebook. However, iPython Notebook is running Python 2 not 3. Over three hours of Googling later, I cannot figure out how to set IPython Notebook to run Python 3 instead of 2. 回答1: To set IPython