Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
118 views

I'm trying to use the %%scalene cell magic in a Jupyter Notebook running on GitHub Codespaces to profile a Numba-accelerated implementation of the Mandelbrot set. However, when I run the following ...
Ahmed Hossam's user avatar
0 votes
0 answers
74 views

I am using VSCode to edit and run my IPython notebooks. Upon using them, I wanted to preserve the coloring of some magic commands like !grep when I used them. Thanks to this question here on SE, I ...
o.spectrum's user avatar
2 votes
2 answers
210 views

Consider the following program, which I wrote in two Jupyter Notebook cells. Cell 1: import rumbledb as rmbl %load_ext rumbledb %env RUMBLEDB_SERVER=http://public.rumbledb.org:9090/jsoniq Cell 2: %%...
Evan Aad's user avatar
  • 6,063
2 votes
1 answer
2k views

I saw someone else using magic commands in VSCode, but when I try them, I get a syntax error. How do I get them to work? File "tmp.py", line 1 %cd ^ SyntaxError: invalid syntax ...
wjandrea's user avatar
  • 33.9k
0 votes
1 answer
2k views

When using Jupyter on VS Code, when I add in %matplotlib notebook, the graph would not show at all When I start to plot without the magic everything is working fine. When graph is not showing after ...
YE1ET's user avatar
  • 33
0 votes
1 answer
108 views

I have a bunch of repeating queries in a Python accessed SQL notebook. I've tested the below colum_to_agg = f'''data_col_1''' sql_aggregates_query=f''' avg({colum_to_agg}) as (concat({colum_to_agg},'...
mapping dom's user avatar
  • 2,055
1 vote
0 answers
340 views

I've been trying to create custom magic for a Glue Studio Notebook, like the following example (taken from here) I've adding the Ipython module by running the glue magic %additional_python_modules ...
DanielS's user avatar
  • 33
2 votes
1 answer
3k views

Jupyter magic commands (starting with a single %, e.g. %timeit) can be run in a script using the answer from How to run an IPython magic from a script (or timing a Python script) However, I cannot ...
ntg's user avatar
  • 14.4k
2 votes
1 answer
1k views

I recently discovered iPython magic functions and wrote some custom magic. I would like to use cell magic to parse strings, change them slightly and return the result. Is there a way to store the ...
hannah's user avatar
  • 35
0 votes
0 answers
135 views

As per the documentation provided by Microsoft Azure Quantum at this link , I followed the steps given and installed Q# with Jupyter Notebook, using Anaconda. I then wrote the following Q# program in ...
NotTheRealV's user avatar
3 votes
2 answers
1k views

Since very recently I have a problem where the output of %%prun is not displayed properly in VS Code Jupyter (all output is on one line instead of in a nicely formatted table). I tried reloading the ...
Louis M's user avatar
  • 4,424
1 vote
1 answer
525 views

I used the magic commands %matplotlib notebook at some ceil in my notebook to animate some scatter plots. However, after that ceil, I want to remove the effect of this magic command. Anyone has any ...
Max Wong's user avatar
  • 750
1 vote
1 answer
162 views

In Ipython can someone use a FORTRAN function in python code,with this way: %load_ext fortranmagic %%fortran subroutine f1(x, z) real, intent(in) :: x real, intent(out) :: z integer :: i ...
Michail Stamatis's user avatar
0 votes
1 answer
1k views

I'm trying to write a Jupyter nbextension where the user can configure the notebook-wide extension behavior using IPython magics. I'm planning on siting the configuration data on the JS side, under an ...
hBy2Py's user avatar
  • 1,842
1 vote
0 answers
197 views

Let's say I have [cell 1] following notebook (I know that could also import this ipython-magic from ~/.ipython/profile_default/startup/: [cell 1] from IPython.display import display, HTML, ...
7beggars_nnnnm's user avatar
1 vote
0 answers
69 views

There is magic link "%lsmagic" to list all available magic links, I want to list only custom registered magic links. Is there any way to list only custom magic links?
veeresh patil's user avatar
0 votes
1 answer
147 views

I am trying to get workers to output some information from their ipython kernel and execute various commands in the ipython session. I tried the examples in the documentation and the ipyparallel ...
SultanOrazbayev's user avatar
0 votes
0 answers
105 views

I'm reading a 1.5 GB CSV file and performing group by operation using jupyter notebook. It works fine when I run the following - path = r"C:\Users\Downloads\Answers.csv" df = pd.read_csv(...
Shradha's user avatar
  • 2,472
6 votes
1 answer
927 views

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 ...
Aristide's user avatar
  • 4,114
0 votes
1 answer
360 views

I am trying to capture majic (%timeit) command results to text file, same executing individually in ipython but calling in .py file, it's throwing syntax error. please help me what exactly missing in ...
Koppula's user avatar
  • 95
1 vote
0 answers
301 views

When running the code below on Spyder, part of the code shown on the IPython console disappears (i.e. it auto scrolls too far down) get_ipython().magic('clear') for i in range(10): print(i) But it ...
Mike's user avatar
  • 102
0 votes
0 answers
2k views

I am using the %store magic to save a variable, then I'd like to %store -r that variable in the same notebook, different execution. In order to automate this, I'd like to do something like: try: %...
Adrian's user avatar
  • 913
0 votes
1 answer
639 views

I have a function that uses the Python importlib package to dynamically reload modules which generates some errors when the user is running the code from IPython and has the autoreload extension ...
Abiel's user avatar
  • 5,525
1 vote
1 answer
565 views

Suppose that I am writing a test called test_this_thing in IPython which I intend to progressively save into a test file test_some_tests.py. When it comes to running my tests I can do that easily from ...
Robert's user avatar
  • 1,686
1 vote
0 answers
142 views

I would like to be able to use python in a way that I can save a session with the data, load it up and carry on with the variables that were in memory. Some of the variables can be fairly large (~1GB),...
baxx's user avatar
  • 4,954
1 vote
1 answer
3k views

I want to give an alias to a command in jupyter notebook such that if i write: Get me list of all students this alias name will call a command that I have written and show the desired result Please ...
Anuj Aggarwal 's user avatar
-1 votes
1 answer
2k views

In ipython cells you can execute shell commands as follows: ipython: print("asdf") !echo asdf However, if you try to import this code from file, asdf.py: def asdf(): print("asdf"...
Entrack's user avatar
  • 51
-1 votes
1 answer
241 views

I am in the process of deploying to Pypi a Python project, let's call it foobar. I would like to distribute it with a shell command and an IPython magic command. I use Poetry, and the relevant part of ...
Aristide's user avatar
  • 4,114
2 votes
1 answer
120 views

I want to make IPython automatically print all str results. In [13]: 'hi\nhi' # I don't want this output Out[13]: 'hi\nhi' In [14]: print(_) # I want it like this, but without using print on every ...
HappyFace's user avatar
  • 4,193
0 votes
1 answer
1k views

Was playing with ipython history commands, experimenting with combining -l and -g to search a limited amount of history, and using -n to see which session a command came from. Suddenly I got an ...
Daniel Goldfarb's user avatar
0 votes
1 answer
1k views

I have defined a custom iPython magic like this: %%writefile pymagic.py from IPython.core import magic_arguments @magic_arguments.magic_arguments() @magic_arguments.argument('--include', '-i', ...
Vignesh Kumar Rk's user avatar
2 votes
0 answers
787 views

In jupyter-lab I can use the magic command %notebook $output_file_path to save the history notebook as a jupyter notebook. When I am working with Google Colab (mounting Google Drive) the path of my ...
Andrea's user avatar
  • 3,117
3 votes
1 answer
1k views

I needed to view reStructuredText files in JupyterLab, and the best I found so far was @akaihola's answer to a related issue on github. I added a work around that would allow rendering the file ...
eldad-a's user avatar
  • 3,241
1 vote
1 answer
4k views

We are using jupyterLab for some long running operations (doing physic simulations in our case). The user should be able to stop these operations safely without killing the kernel. Is there a clean ...
wotanii's user avatar
  • 2,906
1 vote
0 answers
132 views

I'm trying to build a workflow for me to start and resume iPython sessions when debugging issues on a remote machine. I want to log everything I type in, replay it, and have execution continue on ...
Olshansky's user avatar
  • 6,422
11 votes
1 answer
4k views

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 adding % ...
bigbounty's user avatar
  • 17.5k
1 vote
1 answer
989 views

Note: I posted the question at https://github.com/catherinedevlin/ipython-sql/issues/149 I can connect hive/presto using create_engine like this from sqlalchemy.engine import create_engine conn = ...
ZK Zhao's user avatar
  • 21.9k
1 vote
1 answer
2k views

I've found a way to run magic commands, eg from IPython import get_ipython get_ipython().run_line_magic('matplotlib', 'inline') but how do you run something like !ls ? Specifically, I need this to ...
magicrebirth's user avatar
  • 4,264
1 vote
1 answer
2k views

I am logging the RAM usage of sagemath commands against each other and want to automate it I found %memit and I found information on wrapping each [command][How to run an IPython magic from a script (...
927589452's user avatar
2 votes
1 answer
756 views

I want to look at a database schema using %load_ext schemadisplay_magic then %schema but schemadisplay_magic will load. I get an error message saying: No module named 'schemadisplay_magic' IPython ...
Tony McDonald's user avatar
2 votes
1 answer
11k views

Jupyter Notebook has a %load magic that can load code into a cell of a notebook. %load start.py This line loads the content of start.py into the current cell. The magic is automatically commented out ...
TQA's user avatar
  • 267
5 votes
3 answers
4k views

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 am ...
cowboy's user avatar
  • 671
0 votes
1 answer
2k views

I am trying to use the built-in R progress-bar (txtProgressBar) with %%R magic in Jupyter. While it does produce a nice animation when executed in the R console or RStudio, it does not produce the ...
krassowski's user avatar
  • 15.7k
10 votes
2 answers
1k views

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 ...
Tom Hale's user avatar
  • 48.1k
1 vote
2 answers
2k views

I prefer to write my python code on VSCode because of its intellisense and autocomplete features. But I would rather see and debug the code on a Jupyter notebook to better visualize the data I am ...
FTM's user avatar
  • 2,104
2 votes
1 answer
2k views

I am trying to develop a Jupyter notebook that includes cells that have the %load magic command to load code from elsewhere. This code is not in the same directory as where the notebook is. I want ...
Marcel's user avatar
  • 317
3 votes
1 answer
2k views

Code: def combCreate(grp,num): d = chain(*(map(lambda x: (combinations(x,num)),grp))) return set(d) # Comb DataFrame abt Freq & occured date def combFrame(grp): arr = df.loc[:,'date':...
Jack's user avatar
  • 1,764
9 votes
1 answer
3k views

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 time ...
Eran's user avatar
  • 565
1 vote
2 answers
285 views

I was trying to embed some r code on a python 2.7 kernel notebook but it doesn't work. I'm using Anaconda's Jupyter so i've tried : conda install rpy2 or conda install rpy2.ipython Unfortunately ...
Adam Viscusi's user avatar
2 votes
0 answers
550 views

Currently Jupyter Labs does not support Java Script, which causes the ipython magic '%matplotlib inline' to fail with the error: 'JavaScript output is disabled in JupyterLab' I was wondering if ...
465b's user avatar
  • 1,347