O'Reilly logo

Mastering Python for Finance by James Ma Weiming

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Financial analytics of SX5E and V2TX

Another nifty function of pandas is the describe function that gives us a summary statistics of every value inside each column of the Pandas DataFrame object:

>>>  print data.describe()
         EUROSTOXX       VSTOXX
count  4072.000000  4048.000000
mean   3254.538183    25.305428
std     793.191950     9.924404
min    1809.980000    11.596600
25%    2662.460000    18.429500
50%    3033.880000    23.168600
75%    3753.542500    28.409550
max    5464.430000    87.512700
[8 rows x 2 columns]

Pandas allows the values in the DataFrame object to be visualized as a graph using the plot function. Let's plot the EURO STOXX 50 and VSTOX to see how they look like over the years:

>>> from pylab import *
>>> data.plot(subplots=True,
...           figsize=(10, 8),          
...           color="blue",
... grid=True) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required