Questions tagged [ipython]

IPython is a feature-rich interactive shell for Python, and provides a kernel for frontends such as IPython Notebook and Jupyter Notebook.

ipython
Filter by
Sorted by
Tagged with
1111 votes
15 answers
546k views

What is the difference between pip and conda?

I know pip is a package manager for python packages. However, I saw the installation on IPython's website use conda to install IPython. Can I use pip to install IPython? Why should I use conda as ...
lazywei's user avatar
  • 12.3k
947 votes
11 answers
1.3m views

How to make IPython notebook matplotlib plot inline

I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0. I cannot get matplotlib graphics to show up inline. import matplotlib import numpy as np import matplotlib.pyplot ...
Ian Fiske's user avatar
  • 10.5k
938 votes
12 answers
1.0m views

Purpose of "%matplotlib inline"

What exactly is the use of %matplotlib inline?
Rishabh's user avatar
  • 9,677
646 votes
23 answers
89k views

Using IPython / Jupyter Notebooks Under Version Control

What is a good strategy for keeping IPython notebooks under version control? The notebook format is quite amenable for version control: if one wants to version control the notebook and the outputs ...
mforbes's user avatar
  • 7,131
556 votes
14 answers
320k views

Reloading submodules in IPython

Currently I am working on a python project that contains sub modules and uses numpy/scipy. Ipython is used as interactive console. Unfortunately I am not very happy with workflow that I am using right ...
Alain's user avatar
  • 5,665
555 votes
15 answers
412k views

How do I increase the cell width of the Jupyter/ipython notebook in my browser?

I would like to increase the width of the ipython notebook in my browser. I have a high-resolution screen, and I would like to expand the cell width/size to make use of this extra space. Thanks!
vgoklani's user avatar
  • 11.2k
520 votes
5 answers
795k views

Hide all warnings in IPython

I need to produce a screencast of an IPython session, and to avoid confusing viewers, I want to disable all warnings emitted by warnings.warn calls from different packages. Is there a way to configure ...
astrofrog's user avatar
  • 33.5k
423 votes
20 answers
459k views

How do I convert a IPython Notebook into a Python file via commandline?

I'm looking at using the *.ipynb files as the source of truth and programmatically 'compiling' them into .py files for scheduled jobs/tasks. The only way I understand to do this is via the GUI. Is ...
Stefan Krawczyk's user avatar
419 votes
10 answers
514k views

How to make inline plots in Jupyter Notebook larger? [duplicate]

I have made my plots inline on my Ipython Notebook with "%matplotlib inline." Now, the plot appears. However, it is very small. Is there a way to make it appear larger using either notebook ...
Chris's user avatar
  • 30k
376 votes
25 answers
548k views

How do I add python3 kernel to jupyter (IPython)

My Jupyter notebooks installed with python 2 kernel. I do not understand why. I might have messed something up when I did the install. I already have python 3 installed. How can I add it to Jupyter? ...
quickbug's user avatar
  • 4,778
362 votes
15 answers
458k views

How to write LaTeX in IPython Notebook?

How can I display LaTeX code in a IPython Notebook?
KostasA's user avatar
  • 5,354
357 votes
10 answers
241k views

Progress indicator during pandas operations

I regularly perform pandas operations on data frames in excess of 15 million or so rows and I'd love to have access to a progress indicator for particular operations. Does a text based progress ...
cwharland's user avatar
  • 6,483
345 votes
17 answers
495k views

In which conda environment is Jupyter executing?

I have jupyter/anaconda/python3.5. How can I know which conda environment is my jupyter notebook running on? How can I launch jupyter from a new conda environment?
RockScience's user avatar
  • 18.2k
344 votes
14 answers
560k views

Simple way to measure cell execution time in ipython notebook

I would like to get the time spent on the cell execution in addition to the original output from cell. To this end, I tried %%timeit -r1 -n1 but it doesn't expose the variable defined within cell. %%...
colinfang's user avatar
  • 21.4k
330 votes
16 answers
527k views

How can I display an image from a file in Jupyter Notebook?

I would like to use an IPython notebook as a way to interactively analyze some genome charts I am making with Biopython's GenomeDiagram module. While there is extensive documentation on how to use ...
zach's user avatar
  • 30.3k
324 votes
14 answers
514k views

Inserting image into IPython notebook markdown

I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how ...
benpro's user avatar
  • 4,335
323 votes
32 answers
776k views

Change IPython/Jupyter notebook working directory

When I open a Jupyter notebook (formerly IPython) it defaults to C:\Users\USERNAME. How can I change this so to another location?
John's user avatar
  • 42.2k
309 votes
6 answers
302k views

Autoreload of modules in IPython [duplicate]

Is there a way to have IPython automatically reload all changed code? Either before each line is executed in the shell or failing that when it is specifically requested to. I'm doing a lot of ...
Thomas Parslow's user avatar
283 votes
15 answers
467k views

How to run an .ipynb Jupyter Notebook from terminal?

I have some code in a .ipynb file and got it to the point where I don't really need the "interactive" feature of IPython Notebook. I would like to just run it straight from a Mac Terminal ...
Vincent's user avatar
  • 8,348
278 votes
10 answers
596k views

How to display pandas DataFrame of floats using a format string for columns?

I would like to display a pandas dataframe with a given format using print() and the IPython display(). For example: df = pd.DataFrame([123.4567, 234.5678, 345.6789, 456.7890], ...
Jason S's user avatar
  • 187k
273 votes
6 answers
404k views

How to load/edit/run/save text files (.py) into an IPython notebook cell?

I've recently moved over to using IPython notebooks as part of my workflow. However, I've not been successful in finding a way to import .py files into the individual cells of an open IPython ...
aaronsstack's user avatar
  • 2,833
267 votes
11 answers
336k views

Using both Python 2.x and Python 3.x in IPython Notebook

I use IPython notebooks and would like to be able to select to create a 2.x or 3.x python notebook in IPython. I initially had Anaconda. With Anaconda a global environment variable had to be changed ...
deltap's user avatar
  • 4,206
257 votes
7 answers
177k views

What is the difference between Python and IPython?

What exactly is the difference between Python and IPython? If I write code in Python, will it run in IPython as is or does it need to be modified? I know IPython is supposed to be an interactive ...
Asdfsdjlka Asdfsdjlka's user avatar
252 votes
6 answers
347k views

How to embed HTML into IPython output?

Is it possible to embed rendered HTML output into IPython output? One way is to use from IPython.core.display import HTML HTML('<a href="http://example.com">link</a>') or (IPython ...
Anton Tarasenko's user avatar
237 votes
6 answers
378k views

ipython notebook clear cell output in code

In a iPython notebook, I have a while loop that listens to a Serial port and print the received data in real time. What I want to achieve to only show the latest received data (i.e only one line ...
aha's user avatar
  • 4,444
235 votes
13 answers
278k views

collapse cell in jupyter notebook

I am using ipython Jupyter notebook. Let's say I defined a function that occupies a lot of space on my screen. Is there a way to collapse the cell? I want the function to remain executed and ...
aloha's user avatar
  • 4,604
223 votes
7 answers
336k views

Check if a value exists in pandas dataframe index

I am sure there is an obvious way to do this but cant think of anything slick right now. Basically instead of raising exception I would like to get True or False to see if a value exists in pandas df ...
Abhi's user avatar
  • 6,165
222 votes
7 answers
715k views

How to read a .xlsx file using the pandas Library in iPython?

I want to read a .xlsx file using the Pandas Library of python and port the data to a postgreSQL table. All I could do up until now is: import pandas as pd data = pd.ExcelFile("*File Name*") Now I ...
Sabareesh Kappagantu's user avatar
219 votes
12 answers
322k views

How to show PIL Image in ipython notebook

This is my code from PIL import Image pil_im = Image.open('data/empire.jpg') I would like to do some image manipulation on it, and then show it on screen. I am having problem with showing PIL Image ...
WebOrCode's user avatar
  • 7,102
215 votes
23 answers
446k views

"ImportError: No module named" when trying to run Python script

I'm trying to run a script that launches, amongst other things, a python script. I get a ImportError: No module named ..., however, if I launch ipython and import the same module in the same way ...
CodeOcelot's user avatar
  • 3,463
204 votes
16 answers
132k views

Step-by-step debugging with IPython

From what I have read, there are two ways to debug code in Python: With a traditional debugger such as pdb or ipdb. This supports commands such as c for continue, n for step-over, s for step-into etc....
Amelio Vazquez-Reina's user avatar
201 votes
12 answers
238k views

Showing line numbers in IPython/Jupyter Notebooks

Error reports from most language kernels running in IPython/Jupyter Notebooks indicate the line on which the error occurred, but (at least by default) no line numbers are shown in notebooks. How is it ...
Ruggero Turra's user avatar
200 votes
24 answers
233k views

How to hide code from cells in ipython notebook visualized with nbviewer?

I have an ipython/jupyter notebook that I visualize using NBviewer. How can I hide all the code from the notebook rendered by NBviewer, so that only the output of code (e.g. plots and tables) and the ...
lucacerone's user avatar
  • 9,989
200 votes
5 answers
188k views

How do you suppress output in Jupyter running IPython?

How can output to stdout be suppressed? A semi-colon can be used to supress display of returned objects, for example >>> 1+1 2 >>> 1+1; # No output! However, a function that ...
Zero's user avatar
  • 11.8k
200 votes
17 answers
400k views

My plot in ipython does not show with pyplot.show()

Help required displaying matplotlib plots in ipython. I did not forget to call pyplot.show(). $ ipython --pylab import matplotlib.pyplot as plt plt.plot(range(20), range(20)) It returns matplotlib....
Baskaya's user avatar
  • 7,673
195 votes
13 answers
455k views

IOPub data rate exceeded in Jupyter notebook (when viewing image)

I want to view an image in Jupyter notebook. It's a 9.9MB .png file. from IPython.display import Image Image(filename='path_to_image/image.png') I get the below error: IOPub data rate exceeded. The ...
lmart999's user avatar
  • 6,901
190 votes
8 answers
410k views

How to clear variables in ipython?

Sometimes I rerun a script within the same ipython session and I get bad surprises when variables haven't been cleared. How do I clear all variables? And is it possible to force this somehow every ...
grasshopper's user avatar
  • 4,038
186 votes
10 answers
351k views

How to change color in markdown cells ipython/jupyter notebook?

I'm only looking to format a specific string within a cell. I change that cell's format to "Markdown" but I'm not sure how to change text color of a single word. I don't want to change the look of ...
punkrockpolly's user avatar
183 votes
11 answers
268k views

Importing an ipynb file from another ipynb file?

Interactive Python (ipython) is simply amazing, especially as you are piecing things together on the fly... and does it in such a way that it is easy to go back. However, what seems to be interesting ...
Andrew Harris's user avatar
174 votes
3 answers
80k views

ipython: print complete history (not just current session)

in ipython, I can use %hist or %history to print recent history, but this only prints history from current session. I would like to print all history, similar as bash historycommand does. What I am ...
user1968963's user avatar
  • 2,431
173 votes
4 answers
205k views

How to display full output in Jupyter, not only last result?

I want Jupyter to print all the interactive output without resorting to print, not only the last result. How to do it? Example : a=3 a a+1 I would like to display 3 4
mbh86's user avatar
  • 6,258
173 votes
8 answers
130k views

How to programmatically generate markdown output in Jupyter notebooks?

I want to write a report for classes in Jupyter notebook. I'd like to count some stuff, generate some results and include them in markdown. Can I set the output of the cell to be interpreted as ...
fulaphex's user avatar
  • 3,009
168 votes
4 answers
77k views

Passing IPython variables as arguments to bash commands

How do I execute a bash command from Ipython/Jupyter notebook passing the value of a python variable as an argument like in this example: py_var="foo" !grep py_var bar.txt (obviously I want to grep ...
Unni's user avatar
  • 5,656
164 votes
8 answers
230k views

Javascript Error: IPython is not defined in JupyterLab

I have the latest/updated Anaconda package. Everytime I try to plot something using python 3.6.6 I get the following error in JupyterLab... Javascript Error: IPython is not defined When I run the ...
AntMan's user avatar
  • 1,643
161 votes
6 answers
228k views

Running python script inside ipython

Is it possible to run a python script (not module) from inside ipython without indicating its path? I tried to set PYTHONPATH but it seems to work only for modules. I would like to execute %run ...
Tyler Durden's user avatar
  • 1,621
160 votes
5 answers
278k views

What is %timeit in Python?

I always read the code to calculate the time like this way: %timeit function() What does "%" mean here? I think, the "%" is always used to replace something in a string, like %s ...
xirururu's user avatar
  • 5,248
154 votes
16 answers
301k views

Importing .py files in Google Colab

Is there any way to upload my code in .py files and import them in colab code cells? The other way I found is to create a local Jupyter notebook then upload it to Colab, is it the only way?
Reham M Samir's user avatar
153 votes
16 answers
287k views

How to close IPython Notebook properly?

How to close IPython Notebook properly? Currently, I just close the browser tabs and then use Ctrl+C in the terminal. Unfortunately, neither exit() nor ticking Kill kernel upon exit does help (they ...
Piotr Migdal's user avatar
  • 12.3k
152 votes
18 answers
69k views

How can I check if code is executed in the IPython notebook?

I have some Python code example I'd like to share that should do something different if executed in the terminal Python / IPython or in the IPython notebook. How can I check from my Python code if it'...
Christoph's user avatar
  • 2,900
152 votes
5 answers
74k views

How to pickle or store Jupyter (IPython) notebook session for later

Let's say I am doing a larger data analysis in Jupyter/Ipython notebook with lots of time consuming computations done. Then, for some reason, I have to shut down the jupyter local server I, but I ...
redacted's user avatar
  • 3,869

1
2 3 4 5
145