ipython-notebook

matplotlib python inline on/off

心已入冬 提交于 2019-11-26 20:18:23
问题 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. 回答1: You can switch the matplotlib's backend by %matplotlib <backend> . To switch back to your system's default backend use %matplotlib

Link Spark with iPython Notebook

我们两清 提交于 2019-11-26 20:17:41
I have followed some tutorial online but they do not work with Spark 1.5.1 on OS X El Capitan (10.11) Basically I have run this commands download apache-spark brew update brew install scala brew install apache-spark updated the .bash_profile # For a ipython notebook and pyspark integration if which pyspark > /dev/null; then export SPARK_HOME="/usr/local/Cellar/apache-spark/1.5.1/libexec/" export PYSPARK_SUBMIT_ARGS="--master local[2]" fi run ipython profile create pyspark created a startup file ~/.ipython/profile_pyspark/startup/00-pyspark-setup.py configured in this way # Configure the

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

半腔热情 提交于 2019-11-26 20:15:16
问题 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) 回答1: 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. 回答2: The IPython notebook talks to the kernels over

double click to open an ipython notebook

和自甴很熟 提交于 2019-11-26 20:15:14
问题 Related posts: Open an ipython notebook via double-click on osx How can I open Ipython notebook from double click? I always cd to the directory of the notebook, then type ipython notebook in the browser and then open it in the browser. This steps is very inconvenient. In windows, I remembered that I can change the directory in the browser, but in linux there is no way to explore to other directory via browser, if I want to open a new book in another directory, I have to restart another kernel

How to include two pictures side by side in Markdown for IPython Notebook (Jupyter)?

依然范特西╮ 提交于 2019-11-26 19:41:33
问题 I am trying to insert two pictures side by side in one Markdown cell on a notebook. The way I do it was: <img src="pic/scan_concept.png" alt="Drawing" style="width: 250px;"/> in order to be able to size the included picture. Can anyone gives suggestions on top of this? Thanks, 回答1: JMann's solution didn't work for me. But this one worked from IPython.display import HTML, display display(HTML("<table><tr><td><img src='img1'></td><td><img src='img2'></td></tr></table>")) I took the idea from

How to hide one specific cell (input or output) in IPython Notebook?

家住魔仙堡 提交于 2019-11-26 19:28:53
问题 Is there a way to selectively hide one specific input or output cell in IPython notebook? I could only find the below code to show / hide all input cells. http://blog.nextgenetics.net/?e=102 But what if I only want to hide the first input cell of a notebook? 回答1: This is now built into nbconvert (as of 5.3.0) using tags. Here's an example removing a specific cell from the output. Using this notebook. The example has three cells: a markdown cell, a code cell that will be hidden, and a code

Format certain floating dataframe columns into percentage in pandas

…衆ロ難τιáo~ 提交于 2019-11-26 18:58:06
问题 I am trying to write a paper in IPython notebook, but encountered some issues with display format. Say I have following dataframe df , is there any way to format var1 and var2 into 2 digit decimals and var3 into percentages. var1 var2 var3 id 0 1.458315 1.500092 -0.005709 1 1.576704 1.608445 -0.005122 2 1.629253 1.652577 -0.004754 3 1.669331 1.685456 -0.003525 4 1.705139 1.712096 -0.003134 5 1.740447 1.741961 -0.001223 6 1.775980 1.770801 -0.001723 7 1.812037 1.799327 -0.002013 8 1.853130 1

Converting to (not from) ipython Notebook format

天大地大妈咪最大 提交于 2019-11-26 18:49:08
问题 IPython Notebook comes with nbconvert, which can export notebooks to other formats. But how do I convert text in the opposite direction? I ask because I already have materials, and a good workflow, in a different format, but I would like to take advantage of Notebook's interactive environment. A likely solution: A notebook can be created by importing a .py file, and the documentation states that when nbconvert exports a notebook as a python script, it embeds directives in comments that can be

How to pickle or store Jupyter (IPython) notebook session for later

百般思念 提交于 2019-11-26 18:46:53
问题 Let's say I am doing a larger data analysis in Jupyter/Ipython notebook with lots of time consuming computations done. Then, for some reason, I have to shut down the jupyter local server I, but I would like to return to doing the analysis later, without having to go through all the time-consuming computations again. What I would like love to do is pickle or store the whole Jupyter session (all pandas dataframes, np.arrays, variables, ...) so I can safely shut down the server knowing I can

Pandas dataframe hide index functionality?

浪子不回头ぞ 提交于 2019-11-26 16:33:56
问题 Is it possible to hide the index when displaying pandas dataframes, so that only the column names appear at the top of the table? This would need to work for both the html representation in ipython notebook and to_latex() function (which I'm using with nbconvert). Ta. 回答1: Set index=False For ipython notebook: print df.to_string(index=False) For to_latex: df.to_latex(index=False) 回答2: As has been pointed out by @waitingkuo, index=False is what you need. If you want to keep the nice table