Questions tagged [ipython-magic]

A set of pre-defined "magic functions" of IPython that used with the command-line syntax.

A set of pre-defined "magic functions" of that used with the command-line syntax. There are two types of magic functions line-oriented and cell-oriented. The lines start with a magic % and executed from the command line. They get into an argument the rest of the line, where the arguments are passed without parentheses and quotation marks. Cell magic begins with the double %%, and they are functions that get in an argument not only the rest of the line, but the line below it in a separate argument.

169 questions
1
vote
3 answers

Pushbullet on python throws import error due to python-magic unable to find libmagic?

I'm trying to use PushBullet.py which uses python-magic which in turn uses libmagic. I have followed the dependencies instructions and installed Cygwin and copied the three files to Windows\system32 directory but still getting the following…
Ryflex
  • 5,559
  • 25
  • 79
  • 148
1
vote
0 answers

IPython doesn't tab-complete filenames in sub-dirs after %run

Intro I can't get IPython to tab-complete filenames in sub-directories after using the %run magic function. However, completion for files in the current dir works just fine. Also, completion works perfectly if any other magic function is…
DBedrenko
  • 4,871
  • 4
  • 38
  • 73
1
vote
2 answers

Create Ipython magic command for saving last console input to file

Remark now I found a solution of doing it. I want to implement my own magic command in ipython which saves the last input to a python file in order to produce executable python code interactively: I thought about saving it as own magicfile.py in the…
beneminzl
  • 149
  • 2
  • 11
1
vote
1 answer

Update IPython namespace when running script from command-line

In Ipython 0.10, it was possible to run a script from the command-line, then from the interactive mode, immediately get access to the names in the namespace: ipython -i some_script.py %whos tom dick jane I'm now using Python 3.3.2 and…
JS.
  • 14,781
  • 13
  • 63
  • 75
1
vote
1 answer

Installing IPython magic functions from a Python module

I have written some IPython magic functions for my students, and I would like to have them installed using easy_install. So far the only way I have found is to copy a python file to a profile directory, but easy_install complains about a…
John Kitchin
  • 2,236
  • 1
  • 17
  • 25
0
votes
0 answers

How to track output when running a background process in a jupyter notebook using Ipython magic

I am trying to make use of the magic command %%bash --bg to run multiple bash commmands in the background asynchronously from a jupyter notebook session(note %%bash is an alias for %%script bash). I am doing this under the assumption that it will…
0
votes
1 answer

Graph not showing when add in %matplotlib notebook using Jupyter in VS Code

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 adding %matplotlib notebook, removing the magic…
0
votes
1 answer

Using CONCAT in column alias

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},'_mean')), max({colum_to_agg}) as…
mapping dom
  • 1,737
  • 4
  • 27
  • 50
0
votes
0 answers

%debug magic command not working in the Q# Jupyter Notebook environment

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 a Jupyter Notebook (IQ# kernel) using the code…
0
votes
1 answer

Why does `IPython.display.Javascript(...)` work to run a Javascript command in a Jupyter cell but not in an IPython magic?

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 application-specific key in…
0
votes
1 answer

How to use `client.start_ipython_workers()` in dask-distributed?

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 example works, but not the second example (with…
0
votes
0 answers

Using %%timeit results in permission error for large datasets

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(path, encoding = "ISO-8859-1") results2 =…
Shradha
  • 2,232
  • 1
  • 14
  • 26
0
votes
1 answer

%timeit is working individually but failing with .py file

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 my script. from scripts.download_sftp_extract_fun…
Koppula
  • 95
  • 7
0
votes
0 answers

Store or read stored variable in jupyter notebooks, using try/except

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: %store my_variable except UsageError: %store…
Adrian
  • 755
  • 9
  • 17
0
votes
1 answer

Programmatically check for and disable IPython autoreload extension

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 loaded and automatic reloading turned on (i.e.…
Abiel
  • 5,251
  • 9
  • 54
  • 74