ipython-notebook

IPython Notebook Javascript: retrieve content from JavaScript variables

青春壹個敷衍的年華 提交于 2019-11-30 03:30:52
问题 Is there a way for a function (called by an IPython Notebook cell) to retrieve the content of a JavaScript variable (for example IPython.notebook.notebook_path which contains the path of the current notebook)? The following works well when written directly within a cell (for example, based on this question and its comments): from IPython.display import display,Javascript Javascript('IPython.notebook.kernel.execute("mypath = " + "\'"+IPython.notebook.notebook_path+"\'");') But that falls apart

How to preview a part of a large pandas DataFrame, in iPython notebook?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 03:10:59
I am just getting started with pandas in the IPython Notebook and encountering the following problem: When a DataFrame read from a CSV file is small, the IPython Notebook displays it in a nice table view. When the DataFrame is large, something like this is ouput: In [27]: evaluation = readCSV("evaluation_MO_without_VNS_quality.csv").filter(["solver", "instance", "runtime", "objective"]) In [37]: evaluation Out[37]: <class 'pandas.core.frame.DataFrame'> Int64Index: 333 entries, 0 to 332 Data columns: solver 333 non-null values instance 333 non-null values runtime 333 non-null values objective

How to add keyboard shortcuts permanently to Jupyter (ipython) notebook?

孤人 提交于 2019-11-30 03:02:41
问题 I have the following configuration for shortcuts, that works after running it in the cell of Jupiter notebook: %%javascript IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-q', { help: 'Clear all output', // This text will show up on the help page (CTRL-M h or ESC h) handler: function (event) { // Function that gets invoked if (IPython.notebook.mode == 'command') { IPython.notebook.clear_all_output(); return false; } return true; } }); How can I setup Jupiter notebook to make

IPython: Adding Javascript scripts to IPython notebook

风格不统一 提交于 2019-11-30 02:27:00
As a part of a project, I need to embedd some javascripts inside an IPython module. This is what I want to do: from IPython.display import display,Javascript Javascript('echo("sdfds");',lib='/home/student/Gl.js') My Gl.js looks like this function echo(a){ alert(a); } Is there some way so that I can embed "Gl.js" and other such external scripts inside the notebook, such that I dont have to include them as 'lib' argument everytime I try to execute some Javascript code which requires to that library. As a very short-term solution, you can make use of the IPython display() and HTML() functions to

Getting output with IPython Notebook

纵然是瞬间 提交于 2019-11-30 01:31:57
问题 When I launch IPython Notebook I can navigate to it and enter code. However, nothing is ever echo'd back to the IPython Notebook interface. I know the server is getting the queries (from --debug output ) and responding to them it's just never giving me output in my IPython Notebook window. I am running Python 2.6.6 and Windows 7 I am at a loss currently on how to get this notebook thing to work. Here is a screencast of me trying (unsuccessfully) to get output: http://screencast.com/t

inline images have low quality

旧城冷巷雨未停 提交于 2019-11-29 22:57:37
I'm loading a TIF file with scikit-image and displaying it inline in an ipython notebook (version 2.2.0). This works, however, the image is quite small when first displayed, and when I resize it using the draggable handle on the bottom right of the image, it just rescales the image while retaining the resolution of the original, so it's very blurry when enlarged. It's basically as if ipython is converting my image into a thumbnail on the fly. I've tried using matplotlib's plt.imshow() as well, which has the exact same result. I'm starting the notebook with ipython notebook --pylab inline .

resize ipython notebook output window

百般思念 提交于 2019-11-29 21:59:30
By default the ipython notebook ouput is limited to a small sub window at the bottom. This makes us force to use separate scroll bar that comes with the output window, when the output is big. Any configuration option to make it not limited in size, instead run as high as the actual output is? Or option to resize it once it gets created? Matt See the jupyter autoscroll extension (part of jupyter_contrib_nbextensions) , which allows you to select when the output starts scrolling in a dropdown menu (you can set it to never scroll). The API used is not officially supported though, so this may

How to (intermittently) skip certain cells when running IPython notebook?

喜夏-厌秋 提交于 2019-11-29 20:55:27
I usually have to rerun (most parts of) a notebook when reopen it, in order to get access to previously defined variables and go on working. However, sometimes I'd like to skip some of the cells, which have no influence to subsequent cells (e.g., they might comprise a branch of analysis that is finished) and could take very long time to run. These cells can be scattered throughout the notebook, so that something like "Run All Below" won't help much. Is there a way to achieve this? Ideally, those cells could be tagged with some special flags, so that they could be "Run" manually, but would be

Make more than one chart in same IPython Notebook cell

孤街浪徒 提交于 2019-11-29 20:32:46
I have started my IPython Notebook with ipython notebook --pylab inline This is my code in one cell df['korisnika'].plot() df['osiguranika'].plot() This is working fine, it will draw two lines, but on the same chart. I would like to draw each line on a separate chart. And it would be great if the charts would be next to each other, not one after the other. I know that I can put the second line in the next cell, and then I would get two charts. But I would like the charts close to each other, because they represent the same logical unit. Make the multiple axes first and pass them to the Pandas

Plot width settings in ipython notebook

自作多情 提交于 2019-11-29 20:07:06
I've got the following plots: It would look nicer if they have the same width. Do you have any idea how to do it in ipython notebook when I am using %matplotlib inline ? UPDATE: To generate both figures I am using the following functions: import numpy as np import matplotlib.pyplot as plt def show_plots2d(title, plots, points, xlabel = '', ylabel = ''): """ Shows 2D plot. Arguments: title : string Title of the plot. plots : array_like of pairs like array_like and array_like List of pairs, where first element is x axis and the second is the y axis. points : array_like of pairs like integer and