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...