diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2017-02-23 17:32:02 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2017-02-23 17:32:02 -0500 |
| commit | b7fb8538030229bfb77dde15f76197f59244c635 (patch) | |
| tree | 80445421c5a835bdd1f9336cf81f05e26217aa5f | |
| parent | 31cf1177aa62378f6568dc16f09f44707a61d90a (diff) | |
| download | pyisda-b7fb8538030229bfb77dde15f76197f59244c635.tar.gz | |
return DataFrame directly
| -rw-r--r-- | pyisda/credit_index.pyx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index a6228a3..c37c214 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -10,6 +10,7 @@ from cdsone cimport JpmcdsStringToStubMethod, TStubMethod from date cimport ACT_365F cimport numpy as np np.import_array() +import pandas as pd cdef class CurveList: def __init__(self, curves, tickers=None): @@ -161,7 +162,14 @@ cdef class CreditIndex(CurveList): sc, True, &fl_pv[i,j]) - return (fl_pv - accrued, cl_pv) + return pd.concat({'duration': + pd.DataFrame(fl_pv - accrued, + columns=pd.DatetimeIndex(self.maturities), + index=self._tickers), + 'protection_pv': + pd.DataFrame(cl_pv, + columns=pd.DatetimeIndex(self.maturities), + index=self._tickers)}) @cython.boundscheck(False) @cython.cdivision(True) |
