Shell Python and Data Analysis Programs
Shell Python and Data Analysis Programs
This shell apparently resembles a Python session run from a command line, but actually,
it provides many other features that make this shell much more powerful and versatile
than the classic one. To launch this shell, just type ipython on the command line.
> ipython
Python 3.6.3 (default, Oct 15 2017, 3:27:45) [MSC v.1900 64bit (AMD64)]
Type "copyright", "credits", or "license" for more information.
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help
In [1]:
As you can see, a particular prompt appears with the value In [1]. This means that it
is the first line of input. Indeed, IPython offers a system of numbered prompts (indexed)
with input and output caching.
In [1]: print("Hello World!")
Hello World!
In [2]: 3/2
Out[2]: 1.5
In [3]: 5.0/2
Out[3]: 2.5
In [4]:
The same thing applies to values in output that are indicated with the values Out[1],
Out [2], and so on. IPython saves all inputs that you enter by storing them as variables.
In fact, all the inputs entered were included as fields in a list called In.
In [4]: In
Out[4]: [", 'print "Hello World!"', '3/2', '5.0/2', 'In']
The indices of the list elements are the values that appear in each prompt. Thus, to
access a single line of input, you can simply specify that value.
In [5]: In[3]
Out[5]: '5.0/2'