ipython-notebook

Hide SQL statements when running IPython notebook with Django's django-extensions

无人久伴 提交于 2019-12-24 00:47:28
问题 I'm using Django's django-extensions to run an iPython notebook with access to the Django models (as detailed here http://andrewbrookins.com/python/using-ipython-notebook-with-django/). When I make model queries, the notebook shows the underlying SQL queries executed by Django, like so: Can I hide this SQL? It's so voluminous it makes the display unusable at times. 回答1: with recent version, you could use %%capture variable the code to capture stdout and stderr into a variable adding the --no

iPython notebook avoid printing within a function

≡放荡痞女 提交于 2019-12-23 20:31:05
问题 I want to prevent a function to print in iPython notebook. In standard python one can prevent printing some lines of code as answered in the question: To prevent a function from printing in the batch console in Python However this method do not work in iPython notebook, losing the output until a restart of the Kernel. The most similar feature I found is to avoid a full cell to display using the magic function: %%capture capt However this magic function blocks the whole cell, is there any way

ipython notebook save variables after closing

北慕城南 提交于 2019-12-23 17:17:08
问题 After you close the ipython notebook, I realized all the code is there but the namespace has been reset, as in all of the variables I had were gone. Is there a way I could save the variables so that when I turn ipython notebook back on, the variables are all there without rerunning the code? 回答1: Use the storemagic command. http://ipython.org/ipython-doc/rel-0.12/config/extensions/storemagic.html In [1]: l = ['hello',10,'world'] In [2]: %store l In [3]: exit (IPython session is closed and

ipython notebook save variables after closing

寵の児 提交于 2019-12-23 17:13:14
问题 After you close the ipython notebook, I realized all the code is there but the namespace has been reset, as in all of the variables I had were gone. Is there a way I could save the variables so that when I turn ipython notebook back on, the variables are all there without rerunning the code? 回答1: Use the storemagic command. http://ipython.org/ipython-doc/rel-0.12/config/extensions/storemagic.html In [1]: l = ['hello',10,'world'] In [2]: %store l In [3]: exit (IPython session is closed and

Fail Jupyter Notebook installation on clean Ubuntu 14.04 LTS

限于喜欢 提交于 2019-12-23 15:28:44
问题 How do I install develompment version of Jupyter Notebook? $ wget https://bootstrap.pypa.io/get-pip.py $ sudo python get-pip.py $ sudo pip install virtualenv $ cd ~ $ virtualenv local/python/jupyter $ source local/python/jupyter/bin/activate $ git clone --recursive https://github.com/ipython/ipython.git $ cd ipython $ pip install -e ".[notebook]" Could not find a version that satisfies the requirement jupyter-notebook (from ipython==4.0.0.dev0) (from versions: ) Some externally hosted files

How to get tab space in 'markdown' cell of Jupyter Notebook

老子叫甜甜 提交于 2019-12-23 13:57:11
问题 I am writing descriptive ipynb file and need to give output in markdown with space, but unable to add tab space for printing structured data. 回答1: Type "nbsp" to add a single space. Type "ensp" to add 2 spaces. Type "emsp" to add 4 spaces. Use the non-breaking space (nbsp) 4 times to insert a tab. eg.  This is an example. 回答2: If I understand your question then I don't think this has anything to do with Jupyter cells. For example, are you able to type a tab key into a Stackoverflow question

How to get tab space in 'markdown' cell of Jupyter Notebook

那年仲夏 提交于 2019-12-23 13:57:08
问题 I am writing descriptive ipynb file and need to give output in markdown with space, but unable to add tab space for printing structured data. 回答1: Type "nbsp" to add a single space. Type "ensp" to add 2 spaces. Type "emsp" to add 4 spaces. Use the non-breaking space (nbsp) 4 times to insert a tab. eg.  This is an example. 回答2: If I understand your question then I don't think this has anything to do with Jupyter cells. For example, are you able to type a tab key into a Stackoverflow question

Change the size of the label in an IPython notebook widget

拥有回忆 提交于 2019-12-23 12:40:30
问题 This is really a trivial problem, but it is still annoying. I'm writing a tool to allow a user to set a bunch of numerical parameters for an analysis in the IPython notebook. I've set it up as a bunch of FloatTextWidget s in a ContainerWidget . They have rather long labels like "Number of Posture Points" or "Background Disk Radius". They don't line up nicely. This is because of the length: as explained on this page, "The label of the widget has a fixed minimum width. The text of the label is

how does IPython magics work

怎甘沉沦 提交于 2019-12-23 12:34:17
问题 ipthon-sql is an extension of ipython, I first install it by pip install ipython-sql the project is here: https://github.com/catherinedevlin/ipython-sql and my problem is: when I enter %load_ext sql and press SHIFT+ENTER, what's the detailed procedure of IPython to execute this magic sentence? thanks ... 回答1: When you run any code in the notebook, an execute_request is sent via the notebook server, to a 'kernel', a process which executes your code. When the kernel receives your code, it runs

error with python sympy computing integral for cosine function

无人久伴 提交于 2019-12-23 10:09:23
问题 So I was trying an example directly from the sympy documentation and I am getting a strange error. I am using python 3.2 with sympy 0.7.3. I have been working in the ipython notebook, though I don't think that should make a difference. The error is that whenever I create a "x" symbol and try to integrate the math.cos(x), I get an error saying "can't convert expression to float." Here is a code example. This is taken from the sympy documentation. import sympy import math x = sympy.Symbol('x')