Merging the data

Since the earliest dates in the text files are 31.12.1986 and 04.01.1999 for the STOXX Europe 600 and VSTOXX data file respectively, we will require both the datasets to begin from a common date at 04.01.1999. We will also use values from the SX5E and V2TX columns to retrieve our EURO STOXX 50 Index and VSTOXX historical data values. The following Python code extracts these values into a new Pandas DataFrame object:

import datetime as dt

cutoff_date = dt.datetime(1999, 1, 4)
data = pd.DataFrame(
{'EUROSTOXX' :stoxxeu600['SX5E'][stoxxeu600.index >= cutoff_date],
 'VSTOXX':vstoxx['V2TX'][vstoxx.index >= cutoff_date]})

Now, let's take a look at our DataFrame information:

>>> print data.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 4072 entries, 1999-01-04 00:00:00 to 2014-11-18 00:00:00
Data columns (total 2 columns):
EUROSTOXX    4071 non-null float64
VSTOXX       4046 non-null float64
dtypes: float64(2)

Also, let's take a look at the top five lines of our new DataFrame object:

>>> print data.head(5)
            EUROSTOXX   VSTOXX
Date                          
1999-01-04    3543.10  18.2033
1999-01-05    3604.67  29.6912
1999-01-06    3685.36  25.1670
1999-01-07    3627.87  32.5205
1999-01-08    3616.57  33.2296
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.198.94