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 provides a rich architecture for interactive computing with . It includes:


Version updates:

The IPython 3.x release series is the last where IPython is released as one big package. Starting with IPython 4.0, the parts which work for any language are called , while the parts specific to executing Python code remain as IPython.

IPython 5.0 is the last major release to support Python 2.x.


Links:

7180 questions
320
votes
16 answers

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 matplotlib to get graphs inline in IPython notebook,…
zach
  • 29,475
  • 16
  • 67
  • 88
317
votes
32 answers

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
  • 41,131
  • 31
  • 82
  • 106
295
votes
6 answers

Autoreload of modules in IPython

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 exploratory programming using IPython and SciPy and it's…
Thomas Parslow
  • 5,712
  • 4
  • 26
  • 33
277
votes
10 answers

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], index=['foo','bar','baz','quux'], …
Jason S
  • 184,598
  • 164
  • 608
  • 970
270
votes
15 answers

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 Command Line. Basically, if this were just a .py file, I…
Vincent
  • 7,808
  • 13
  • 49
  • 63
269
votes
6 answers

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 notebook so that they can edited, run and then saved.…
aaronsstack
  • 2,793
  • 3
  • 13
  • 8
267
votes
11 answers

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 to select what version of python you want and…
deltap
  • 4,176
  • 7
  • 26
  • 35
251
votes
7 answers

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 shell for Python, but is that all? Or is there a…
Asdfsdjlka Asdfsdjlka
  • 2,671
  • 2
  • 13
  • 3
247
votes
6 answers

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('link') or (IPython multiline cell alias) %%html
Anton Tarasenko
  • 8,099
  • 11
  • 66
  • 91
233
votes
13 answers

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 callable, yet I want to hide / collapse the cell in order…
aloha
  • 4,554
  • 6
  • 32
  • 40
225
votes
6 answers

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 showing the most recent data. no scrolling in the cell…
aha
  • 4,314
  • 4
  • 23
  • 27
220
votes
7 answers

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 index. import pandas as pd df =…
Abhi
  • 6,075
  • 10
  • 41
  • 55
214
votes
7 answers

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 know that the step got executed successfully, but…
Sabareesh Kappagantu
  • 2,367
  • 3
  • 18
  • 15
210
votes
23 answers

"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 through the interpreter, the module is…
CodeOcelot
  • 3,403
  • 3
  • 22
  • 23
203
votes
12 answers

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 in python notebook. I have tried: print…
WebOrCode
  • 6,852
  • 9
  • 43
  • 70