ipython

How to work with .ipynb files without launching the Jupyter Notebook server?

萝らか妹 提交于 2020-01-16 08:35:22
问题 I'm starting to work more with Jupyter notebooks, and am really starting to like it. However, I find it difficult to use it with my particular setup. I have a workstation for running all the notebooks, but for a large part of my day I'm on-the-go with a space-constrained laptop with no power outlets. I'd like to be able to edit (but not run) these notebooks without installing and running the full Jupyter server backend, which I imagine would suck up a lot of power. My question is: Is it

Importing a variable from another script and keeping it updated

只谈情不闲聊 提交于 2020-01-16 03:18:22
问题 I have two .py scripts. script1.py and script2.py I am importing few variables from script2.py like: from script2 import variable1 as var1 which works fine. But when I update variable1 in script2.py , and then re-run script1.py , the update of variable1 doesn't show up in script1.py . Why is that so? The update of variable1 shows up if I close IPython completely and then re-open IPython again. But I don't want to do this all the time as I need few plot's to be open. I am using IPython 1.2.1

plt.figure.Figure.show() does nothing when not executing interactively

谁说我不能喝 提交于 2020-01-16 02:04:52
问题 So I have a following simple code saved in a .py file, and executing in shell: import matplotlib.pyplot as plt myfig = plt.figure(figsize=(5, 5)) ax1 = myfig.add_subplot(1, 1, 1) myfig.show() However it does nothing upon execution, no errors nothing. Then when I start Ipython in shell, and type exact same code, it does pop up an empty window. Why is that? of course I can use plt.show() and everything is fine. But lets say I have two figures, fig1 and fig2, and there is stuff in both figs, and

matplotlib not using matplotlibrc file in IPython

对着背影说爱祢 提交于 2020-01-15 09:16:09
问题 I recently upgraded from matplotlib v1.5.3 from v2.0.0, but with this change, it seems that matplotlib no longer uses my edited matplotlibrc file when plotting figures. When I open the matplotlibrc file, I see that my changes are in fact implemented, but when I type matplotlib.rcParams , these changes are not displayed. Thinking that maybe it was looking at a different matplotlibrc file, I ran matplotlib.matplotlib_fname() , but this points to the same directory of my edited matplotlibrc file

IPython/Jupyter notebook 3 - hide headers by default

試著忘記壹切 提交于 2020-01-14 09:47:08
问题 Before IPython notebook version 3.0 the notebook headers could be hidden by default by adding this to ".ipython\profile_default\static\custom\custom.js" (on Windows): $([IPython.events]).on("app_initialized.NotebookApp", function () { $('div#header').hide(); $('div#maintoolbar').hide(); }); or for Jupyter, "~/.jupyter/custom/custom.js", with IPython replaced by Jupyter . also see this question This does not seem to work anymore. It hides the headers, but it also leaves a big gap on the page's

Cython unable to find shared object file

只愿长相守 提交于 2020-01-13 16:29:13
问题 I am trying to link to my own C library from Cython, following the directions I've found on the web, including this answer: Using Cython To Link Python To A Shared Library I am running IPython through Spyder. My setup.py looks like this: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize import numpy as np setup( ext_modules = cythonize( [Extension("*",["*.pyx"], libraries =["MyLib"], extra_compile_args = ["-fopenmp","-O3"], extra

Clear widget area of a cell in a Jupyter notebook from within notebook

﹥>﹥吖頭↗ 提交于 2020-01-13 10:17:14
问题 I'm wondering if it's possible to clear the widget area of a cell in a Jupyter notebook from the notebook side (ie within Python). IPython.display.clear_output() only clears the cell's output area not the widget area. Update: this still seems to be a problem in latest Notebook and ipywidgets. Here are two minimal examples illustrating the problem I'm struggling with. The widget output that I'm trying to clear in particular are the data frames rendered by qgrid. In both cases, despite trying

cython in jupyter notebook

雨燕双飞 提交于 2020-01-13 08:29:42
问题 I am getting errors when loading a Cython file in Jupyter Notebook. Any ideas? %load_ext Cython import numpy as np cimport numpy as np import cython Just a simple error message: File "<ipython-input-3-7e39dc7f561b>", line 5 cimport numpy as np ^ SyntaxError: invalid syntax 回答1: After reading the docs -- I used two separate cells. The first one is just: %load_ext Cython Then my import statements %%cython import numpy as np cimport numpy as np import cython 来源: https://stackoverflow.com

Change default background color for matplotlib plots

自闭症网瘾萝莉.ら 提交于 2020-01-13 08:12:29
问题 I am using ipython with matplotlib . Is it possible to configure the default background color for matplotlib plots? The curent (white) colour must come from somewhere. Is it possible to override it to, lets say, #CCCCCC ? Note: By default, I don't mean default for a given ipython notebook. I mean default for my matplotlib installation. The solution suggested by @Ffisegydd works. however, after setting axes.facecolor : F4EAEA , I still get white edges around the plot: How can I get rid of

How to display a text paragraph next to figure in jupyter/ipython notebook

天大地大妈咪最大 提交于 2020-01-13 04:53:11
问题 I am looking for a (perhaps creative) way to place text next to a graph in the jupyter notebook. The idea is to have a detailed description of the chart, right next to it, instead of the usual vertical flow of the notebook. Any ideas? 回答1: A rather creative way is to mimic the inline backend but adding a underlying table. A possible solution for python 2.7 could look like from io import BytesIO import matplotlib.pyplot as plt from IPython.display import display, Image, HTML import base64 def