diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2017-05-12 13:54:09 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2017-05-12 13:54:09 -0400 |
| commit | 2a7fe6da1a51efe04ca0b44d05d7f8016dd3c811 (patch) | |
| tree | 6e89ff2b68ff62f118d4cec76e26afb48a197a9f | |
| parent | 6cbe0d8aef93bbd8be02e42b2959b4d6ece625ba (diff) | |
| download | pyisda-2a7fe6da1a51efe04ca0b44d05d7f8016dd3c811.tar.gz | |
return Series instead
| -rw-r--r-- | pyisda/curve.pyx | 7 |
1 files 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: |
