From b7fb8538030229bfb77dde15f76197f59244c635 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 23 Feb 2017 17:32:02 -0500 Subject: return DataFrame directly --- pyisda/credit_index.pyx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3-70-g09d2