ipython-magic Questions
3
Solved
I am trying to connect to our remote sql server db via Jupyter Labs using the SQL magics. I can connect with a traditional connection string, but the SQL magics doesnt seem to work (which means I a...
Habiliment asked 7/5, 2019 at 22:39
11
Solved
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,...
Guizot asked 11/10, 2013 at 2:25
3
I would like to be able to save the TEXT output of an iPython notebook cell into a file on disk.
I have 2 additional requirements/requests:
be able to re-run the cell and overwrite my output w...
Alexisaley asked 16/1, 2015 at 22:58
2
Solved
I'm running an IPython notebook by using the %run magic in another (parent) notebook.
I would like to hide some of the output in the child notebook if it is called using %run and think I can do th...
Cicero asked 2/1, 2018 at 20:38
6
I am a python and Ipython beginner. This may be a trivial question. It is probably duplicated with other questions. However I do not know what key words I should search.
I have already known how t...
Fromenty asked 5/5, 2015 at 17:7
2
How can I put a comment at the end of an IPython magic command?
Eg, trying to use %cd:
%cd "dir" # comment
I want to change to directory dir but instead I get:
[Errno 2] No such file or...
Thermometry asked 12/12, 2018 at 23:7
3
I would like to leave an IPython notebook running to do some computation + show some visuals.
Once the IPython notebook has finished, I want the last cell in the IPython notebook to programmatical...
Admissible asked 26/8, 2015 at 21:49
3
I want to put couple of cells with commands I need in almost every new notebook in every new notebook I create.
For example when I create a new notebook it should put a
%matplotlib inline
import...
Seaweed asked 6/2, 2015 at 10:48
8
Solved
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)?
Unworthy asked 25/10, 2013 at 1:21
2
I'm aware of the %reset and %reset_selective commands in IPython. However, let's say you have many variables and you want to clear all variables except x, y, z. Is there a concise way to accomplish...
Embryology asked 13/5, 2015 at 15:23
2
Solved
I can't figure out how to store the result from cell magic - %%timeit? I've read:
Can you capture the output of ipython's magic methods?
Capture the result of an IPython magic function
and in...
Moise asked 27/12, 2016 at 19:26
1
Solved
What difference does it make to use %timeit and %%timeit in ipython? Because when I read the documentation using ?%timeit and ?%%timeit it was the same documentation. So, what difference does addin...
Whisky asked 29/10, 2019 at 12:52
4
Solved
In a Linux terminal, when the output of one command is too long to read in one page, I can do this:
cat file | less
so that I can read and scroll up and down the output from the cat file.
How c...
Bin asked 21/4, 2011 at 7:18
5
Solved
I want to do something like the following:
In[1]: name = 'long_name_to_type_every_now_and_then.py'
In[2]: %run name
but this actually tries to run 'name.py', which is not what I want to do.
Is...
Rebarbative asked 18/1, 2013 at 23:14
1
Solved
The %load line-magic command loads the content of a given file into the current cell, for instance, executing:
[cell 1] %load hello_world.py
... transform the cell into:
[cell 1] # %load hello_wor...
Sprouse asked 20/12, 2020 at 12:31
1
I am using %%time in Jupyter-notebook to measure run time of my Python code. The problem is that it prints only the Wall time on Windows but works fine on Ubuntu.
Is it possible to get the CPU tim...
Trahurn asked 16/5, 2018 at 8:51
1
Solved
The %%cython command is pretty handy to create cython functions without building and using a package. The command has several options but I couldn't find a way to specify compile time environmental...
Scab asked 7/1, 2017 at 21:4
2
Solved
We can define an alias in ipython with the %alias magic function, like this:
>>> d
NameError: name 'd' is not defined
>>> %alias d date
>>> d
Fri May 15 00:12:20 AEST 20...
Tuttle asked 14/5, 2015 at 14:39
5
If I have several IPython notebooks running on the same server. Is there any way to share data between them? For example, importing a variable from another notebook? Thanks!
Lima asked 24/7, 2015 at 23:53
3
I am running IPython on Windows 7 and can use the %paste magic command to paste from the clipboard. However, I cannot copy from IPython to the clipboard. I want to copy code snippets from IPython a...
Nuristan asked 9/5, 2013 at 20:39
3
Solved
I'm trying to capture the resulting object of IPython Notebook magic function. Specifically %timeit
So the following code...
import time
def say_hello(n):
time.sleep(n)
print "hello"
t = %time...
Gunn asked 13/8, 2014 at 14:53
1
I'm trying to read a file using python and I keep getting this error
ERROR: Line magic function `%user_vars` not found.
My code is very basic just
names = read_csv('Combined data.csv')
names.h...
Japanese asked 30/7, 2015 at 23:14
1
Solved
I want to run pycuda from an IPython notebook on a Linux laptop with NVIDIA Optimus (bumblebee). Usually, I can get a python script running by typing optirun python my_pycuda_script.py
But if I s...
Zeitler asked 17/6, 2014 at 15:57
0
I am trying to measure the execution time of different parts of my code, a few lines each. I am doing this with %%timeit, however after I execute a cell, I find that the values calculated for varia...
Golem asked 13/2, 2018 at 15:0
1
Solved
The %timeit magic supports execution in line mode and cell mode. Using the cell mode, invoked with %%timeit (note: two percent symbols), can be used to exclude some setup code from the measurement:...
Cianca asked 29/1, 2018 at 16:27
1 Next >
© 2022 - 2025 — McMap. All rights reserved.