From 2a7fe6da1a51efe04ca0b44d05d7f8016dd3c811 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Fri, 12 May 2017 13:54:09 -0400 Subject: return Series instead --- pyisda/curve.pyx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index a9528f7..cb20d63 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -83,7 +83,7 @@ cdef class Curve(object): 'data': fArray_to_list(self._thisptr.get().fArray, self._thisptr.get().fNumItems)} @cython.boundscheck(False) - def to_df(self): + def to_series(self): cdef np.npy_intp n = self._thisptr.get().fNumItems cdef np.ndarray[np.float64_t,ndim=1] h = np.PyArray_EMPTY(1, &n, np.NPY_DOUBLE, 0) cdef np.ndarray[np.int64_t,ndim=1] d = np.PyArray_EMPTY(1, &n, np.NPY_INT64, 0) @@ -91,9 +91,8 @@ cdef class Curve(object): cdef TRatePt* it = self._thisptr.get().fArray for i in range(n): h[i] = it[i].fRate - d[i] = it[i].fDate -134774 - - return {'hazard_rates': h, 'dates':d.view('M8[D]')} + d[i] = it[i].fDate - 134774 + return pd.Series(h, index=d.view('M8[D]'), name='hazard_rates') def __iter__(self): cdef: -- cgit v1.2.3-70-g09d2