~pythonxy/pythonxy-upstream/python-pandas

« back to all changes in this revision

Viewing changes to pandas/lib/src/tseries.c

  • Committer: Wes McKinney
  • Date: 2009-08-05 03:30:16 UTC
  • Revision ID: git-v1:c6b236db73ff81007909be6406f0e484edc4a9eb
first commit with cleaned up code

git-svn-id: http://pandas.googlecode.com/svn/trunk@5 d5231056-7de3-11de-ac95-d976489f1ece

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Generated by Cython 0.11.2 on Tue Aug  4 23:05:09 2009 */
 
2
 
 
3
#define PY_SSIZE_T_CLEAN
 
4
#include "Python.h"
 
5
#include "structmember.h"
 
6
#ifndef Py_PYTHON_H
 
7
    #error Python headers needed to compile C extensions, please install development version of Python.
 
8
#endif
 
9
#ifndef PY_LONG_LONG
 
10
  #define PY_LONG_LONG LONG_LONG
 
11
#endif
 
12
#ifndef DL_EXPORT
 
13
  #define DL_EXPORT(t) t
 
14
#endif
 
15
#if PY_VERSION_HEX < 0x02040000
 
16
  #define METH_COEXIST 0
 
17
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
 
18
#endif
 
19
#if PY_VERSION_HEX < 0x02050000
 
20
  typedef int Py_ssize_t;
 
21
  #define PY_SSIZE_T_MAX INT_MAX
 
22
  #define PY_SSIZE_T_MIN INT_MIN
 
23
  #define PY_FORMAT_SIZE_T ""
 
24
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
 
25
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
 
26
  #define PyNumber_Index(o)    PyNumber_Int(o)
 
27
  #define PyIndex_Check(o)     PyNumber_Check(o)
 
28
#endif
 
29
#if PY_VERSION_HEX < 0x02060000
 
30
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
 
31
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
 
32
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
 
33
  #define PyVarObject_HEAD_INIT(type, size) \
 
34
          PyObject_HEAD_INIT(type) size,
 
35
  #define PyType_Modified(t)
 
36
 
 
37
  typedef struct {
 
38
       void *buf;
 
39
       PyObject *obj;
 
40
       Py_ssize_t len;
 
41
       Py_ssize_t itemsize;
 
42
       int readonly;
 
43
       int ndim;
 
44
       char *format;
 
45
       Py_ssize_t *shape;
 
46
       Py_ssize_t *strides;
 
47
       Py_ssize_t *suboffsets;
 
48
       void *internal;
 
49
  } Py_buffer;
 
50
 
 
51
  #define PyBUF_SIMPLE 0
 
52
  #define PyBUF_WRITABLE 0x0001
 
53
  #define PyBUF_FORMAT 0x0004
 
54
  #define PyBUF_ND 0x0008
 
55
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
 
56
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
 
57
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
 
58
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
 
59
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
 
60
 
 
61
#endif
 
62
#if PY_MAJOR_VERSION < 3
 
63
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
 
64
#else
 
65
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
 
66
#endif
 
67
#if PY_MAJOR_VERSION >= 3
 
68
  #define Py_TPFLAGS_CHECKTYPES 0
 
69
  #define Py_TPFLAGS_HAVE_INDEX 0
 
70
#endif
 
71
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
 
72
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 
73
#endif
 
74
#if PY_MAJOR_VERSION >= 3
 
75
  #define PyBaseString_Type            PyUnicode_Type
 
76
  #define PyString_Type                PyBytes_Type
 
77
  #define PyString_CheckExact          PyBytes_CheckExact
 
78
  #define PyInt_Type                   PyLong_Type
 
79
  #define PyInt_Check(op)              PyLong_Check(op)
 
80
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
 
81
  #define PyInt_FromString             PyLong_FromString
 
82
  #define PyInt_FromUnicode            PyLong_FromUnicode
 
83
  #define PyInt_FromLong               PyLong_FromLong
 
84
  #define PyInt_FromSize_t             PyLong_FromSize_t
 
85
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
 
86
  #define PyInt_AsLong                 PyLong_AsLong
 
87
  #define PyInt_AS_LONG                PyLong_AS_LONG
 
88
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
 
89
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
 
90
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 
91
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
 
92
#else
 
93
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
 
94
  #define PyBytes_Type                 PyString_Type
 
95
#endif
 
96
#if PY_MAJOR_VERSION >= 3
 
97
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
 
98
#endif
 
99
#if !defined(WIN32) && !defined(MS_WINDOWS)
 
100
  #ifndef __stdcall
 
101
    #define __stdcall
 
102
  #endif
 
103
  #ifndef __cdecl
 
104
    #define __cdecl
 
105
  #endif
 
106
  #ifndef __fastcall
 
107
    #define __fastcall
 
108
  #endif
 
109
#else
 
110
  #define _USE_MATH_DEFINES
 
111
#endif
 
112
#if PY_VERSION_HEX < 0x02050000
 
113
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
 
114
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
 
115
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
 
116
#else
 
117
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
 
118
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
 
119
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
 
120
#endif
 
121
#if PY_VERSION_HEX < 0x02050000
 
122
  #define __Pyx_NAMESTR(n) ((char *)(n))
 
123
  #define __Pyx_DOCSTR(n)  ((char *)(n))
 
124
#else
 
125
  #define __Pyx_NAMESTR(n) (n)
 
126
  #define __Pyx_DOCSTR(n)  (n)
 
127
#endif
 
128
#ifdef __cplusplus
 
129
#define __PYX_EXTERN_C extern "C"
 
130
#else
 
131
#define __PYX_EXTERN_C extern
 
132
#endif
 
133
#include <math.h>
 
134
#define __PYX_HAVE_API__tseries
 
135
#include "numpy/arrayobject.h"
 
136
#include "datetime.h"
 
137
#include "string.h"
 
138
#include "math.h"
 
139
#include "stdlib.h"
 
140
#define __PYX_USE_C99_COMPLEX defined(_Complex_I)
 
141
 
 
142
 
 
143
#ifdef __GNUC__
 
144
#define INLINE __inline__
 
145
#elif _WIN32
 
146
#define INLINE __inline
 
147
#else
 
148
#define INLINE 
 
149
#endif
 
150
 
 
151
typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/
 
152
 
 
153
 
 
154
 
 
155
static int __pyx_skip_dispatch = 0;
 
156
 
 
157
 
 
158
/* Type Conversion Predeclarations */
 
159
 
 
160
#if PY_MAJOR_VERSION < 3
 
161
#define __Pyx_PyBytes_FromString          PyString_FromString
 
162
#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
 
163
#define __Pyx_PyBytes_AsString            PyString_AsString
 
164
#else
 
165
#define __Pyx_PyBytes_FromString          PyBytes_FromString
 
166
#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
 
167
#define __Pyx_PyBytes_AsString            PyBytes_AsString
 
168
#endif
 
169
 
 
170
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 
171
static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 
172
static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
 
173
 
 
174
#if !defined(T_PYSSIZET)
 
175
#if PY_VERSION_HEX < 0x02050000
 
176
#define T_PYSSIZET T_INT
 
177
#elif !defined(T_LONGLONG)
 
178
#define T_PYSSIZET \
 
179
        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
 
180
        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
 
181
#else
 
182
#define T_PYSSIZET \
 
183
        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
 
184
        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
 
185
        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
 
186
#endif
 
187
#endif
 
188
 
 
189
#if !defined(T_SIZET)
 
190
#if !defined(T_ULONGLONG)
 
191
#define T_SIZET \
 
192
        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
 
193
        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
 
194
#else
 
195
#define T_SIZET \
 
196
        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
 
197
        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
 
198
        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
 
199
#endif
 
200
#endif
 
201
 
 
202
static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 
203
static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 
204
static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
205
 
 
206
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 
207
 
 
208
 
 
209
#ifdef __GNUC__
 
210
/* Test for GCC > 2.95 */
 
211
#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
 
212
#define likely(x)   __builtin_expect(!!(x), 1)
 
213
#define unlikely(x) __builtin_expect(!!(x), 0)
 
214
#else /* __GNUC__ > 2 ... */
 
215
#define likely(x)   (x)
 
216
#define unlikely(x) (x)
 
217
#endif /* __GNUC__ > 2 ... */
 
218
#else /* __GNUC__ */
 
219
#define likely(x)   (x)
 
220
#define unlikely(x) (x)
 
221
#endif /* __GNUC__ */
 
222
    
 
223
static PyObject *__pyx_m;
 
224
static PyObject *__pyx_b;
 
225
static PyObject *__pyx_empty_tuple;
 
226
static int __pyx_lineno;
 
227
static int __pyx_clineno = 0;
 
228
static const char * __pyx_cfilenm= __FILE__;
 
229
static const char *__pyx_filename;
 
230
static const char **__pyx_f;
 
231
 
 
232
 
 
233
#ifdef CYTHON_REFNANNY
 
234
typedef struct {
 
235
  void (*INCREF)(void*, PyObject*, int);
 
236
  void (*DECREF)(void*, PyObject*, int);
 
237
  void (*GOTREF)(void*, PyObject*, int);
 
238
  void (*GIVEREF)(void*, PyObject*, int);
 
239
  void* (*NewContext)(const char*, int, const char*);
 
240
  void (*FinishContext)(void**);
 
241
} __Pyx_RefnannyAPIStruct;
 
242
static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
 
243
#define __Pyx_ImportRefcountAPI(name)   (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
 
244
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
 
245
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
 
246
#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
 
247
#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
 
248
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
 
249
#define __Pyx_SetupRefcountContext(name)   void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
 
250
#define __Pyx_FinishRefcountContext()   __Pyx_Refnanny->FinishContext(&__pyx_refchk)
 
251
#else
 
252
#define __Pyx_INCREF(r) Py_INCREF(r)
 
253
#define __Pyx_DECREF(r) Py_DECREF(r)
 
254
#define __Pyx_GOTREF(r)
 
255
#define __Pyx_GIVEREF(r)
 
256
#define __Pyx_XDECREF(r) Py_XDECREF(r)
 
257
#define __Pyx_SetupRefcountContext(name)
 
258
#define __Pyx_FinishRefcountContext()
 
259
#endif /* CYTHON_REFNANNY */
 
260
#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
 
261
#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)
 
262
 
 
263
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
264
 
 
265
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
266
 
 
267
static void __Pyx_RaiseDoubleKeywordsError(
 
268
    const char* func_name, PyObject* kw_name); /*proto*/
 
269
 
 
270
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
 
271
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
272
 
 
273
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
 
274
 
 
275
/* Run-time type information about structs used with buffers */
 
276
struct __Pyx_StructField_;
 
277
 
 
278
typedef struct {
 
279
  const char* name; /* for error messages only */
 
280
  struct __Pyx_StructField_* fields;
 
281
  size_t size;     /* sizeof(type) */
 
282
  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
 
283
} __Pyx_TypeInfo;
 
284
 
 
285
typedef struct __Pyx_StructField_ {
 
286
  __Pyx_TypeInfo* type;
 
287
  const char* name;
 
288
  size_t offset;
 
289
} __Pyx_StructField;
 
290
 
 
291
typedef struct {
 
292
  __Pyx_StructField* field;
 
293
  size_t parent_offset;
 
294
} __Pyx_BufFmt_StackElem;
 
295
 
 
296
 
 
297
static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
298
static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
 
299
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
 
300
 
 
301
static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
302
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
303
 
 
304
static INLINE void __Pyx_RaiseNoneNotIterableError(void);
 
305
 
 
306
static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
307
 
 
308
static INLINE void __Pyx_RaiseTooManyValuesError(void);
 
309
 
 
310
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
 
311
 
 
312
static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
 
313
static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/
 
314
 
 
315
 
 
316
static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
 
317
    PyObject *r;
 
318
    if (!j) return NULL;
 
319
    r = PyObject_GetItem(o, j);
 
320
    Py_DECREF(j);
 
321
    return r;
 
322
}
 
323
 
 
324
 
 
325
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
 
326
                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
 
327
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 
328
 
 
329
static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
 
330
    if (likely(o != Py_None)) {
 
331
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
 
332
            PyObject *r = PyList_GET_ITEM(o, i);
 
333
            Py_INCREF(r);
 
334
            return r;
 
335
        }
 
336
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
 
337
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
 
338
            Py_INCREF(r);
 
339
            return r;
 
340
        }
 
341
    }
 
342
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
 
343
}
 
344
 
 
345
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
 
346
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
 
347
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 
348
 
 
349
static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
 
350
    if (likely(o != Py_None)) {
 
351
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
 
352
            PyObject *r = PyTuple_GET_ITEM(o, i);
 
353
            Py_INCREF(r);
 
354
            return r;
 
355
        }
 
356
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
 
357
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
 
358
            Py_INCREF(r);
 
359
            return r;
 
360
        }
 
361
    }
 
362
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
 
363
}
 
364
 
 
365
 
 
366
#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
 
367
                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
 
368
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 
369
 
 
370
static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
 
371
    PyObject *r;
 
372
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
 
373
        r = PyList_GET_ITEM(o, i);
 
374
        Py_INCREF(r);
 
375
    }
 
376
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
 
377
        r = PyTuple_GET_ITEM(o, i);
 
378
        Py_INCREF(r);
 
379
    }
 
380
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
 
381
        r = PySequence_GetItem(o, i);
 
382
    }
 
383
    else {
 
384
        r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
 
385
    }
 
386
    return r;
 
387
}
 
388
 
 
389
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
 
390
    const char *name, int exact); /*proto*/
 
391
 
 
392
static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
393
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
394
#if PY_MAJOR_VERSION < 3
 
395
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
 
396
static void __Pyx_ReleaseBuffer(Py_buffer *view);
 
397
#else
 
398
#define __Pyx_GetBuffer PyObject_GetBuffer
 
399
#define __Pyx_ReleaseBuffer PyBuffer_Release
 
400
#endif
 
401
 
 
402
Py_ssize_t __Pyx_zeros[] = {0};
 
403
Py_ssize_t __Pyx_minusones[] = {-1};
 
404
 
 
405
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
 
406
 
 
407
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
408
 
 
409
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
410
 
 
411
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
 
412
static int __Pyx_EndUnpack(PyObject *); /*proto*/
 
413
 
 
414
#if __PYX_USE_C99_COMPLEX
 
415
    #define __Pyx_REAL_PART(z) __real__(z)
 
416
    #define __Pyx_IMAG_PART(z) __imag__(z)
 
417
#else
 
418
    #define __Pyx_REAL_PART(z) ((z).real)
 
419
    #define __Pyx_IMAG_PART(z) ((z).imag)
 
420
#endif
 
421
 
 
422
#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z))
 
423
 
 
424
#if __PYX_USE_C99_COMPLEX
 
425
 
 
426
    typedef float _Complex __pyx_t_float_complex;
 
427
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
 
428
      return x + y*(__pyx_t_float_complex)_Complex_I;
 
429
    }
 
430
    
 
431
    #define __pyx_t_float_complex_is_zero(a) ((a) == 0)
 
432
    #define __pyx_t_float_complex_eq(a, b) ((a) == (b))
 
433
    #define __pyx_t_float_complex_add(a, b) ((a)+(b))
 
434
    #define __pyx_t_float_complex_sub(a, b) ((a)-(b))
 
435
    #define __pyx_t_float_complex_mul(a, b) ((a)*(b))
 
436
    #define __pyx_t_float_complex_div(a, b) ((a)/(b))
 
437
    #define __pyx_t_float_complex_neg(a) (-(a))
 
438
 
 
439
#else
 
440
 
 
441
    typedef struct { float real, imag; } __pyx_t_float_complex;
 
442
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
 
443
      __pyx_t_float_complex c; c.real = x; c.imag = y; return c;
 
444
    }
 
445
    
 
446
    static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) {
 
447
       return (a.real == 0) & (a.imag == 0);
 
448
    }
 
449
 
 
450
    static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) {
 
451
       return (a.real == b.real) & (a.imag == b.imag);
 
452
    }
 
453
 
 
454
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__pyx_t_float_complex a, __pyx_t_float_complex b) {
 
455
        __pyx_t_float_complex z;
 
456
        z.real = a.real + b.real;
 
457
        z.imag = a.imag + b.imag;
 
458
        return z;
 
459
    }
 
460
 
 
461
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__pyx_t_float_complex a, __pyx_t_float_complex b) {
 
462
        __pyx_t_float_complex z;
 
463
        z.real = a.real - b.real;
 
464
        z.imag = a.imag - b.imag;
 
465
        return z;
 
466
    }
 
467
 
 
468
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__pyx_t_float_complex a, __pyx_t_float_complex b) {
 
469
        __pyx_t_float_complex z;
 
470
        z.real = a.real * b.real - a.imag * b.imag;
 
471
        z.imag = a.real * b.imag + a.imag * b.real;
 
472
        return z;
 
473
    }
 
474
 
 
475
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__pyx_t_float_complex a, __pyx_t_float_complex b) {
 
476
        __pyx_t_float_complex z;
 
477
        float denom = b.real*b.real + b.imag*b.imag;
 
478
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
 
479
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
 
480
        return z;
 
481
    }
 
482
 
 
483
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) {
 
484
        __pyx_t_float_complex z;
 
485
        z.real = -a.real;
 
486
        z.imag = -a.imag;
 
487
        return z;
 
488
    }
 
489
 
 
490
#endif
 
491
 
 
492
#if __PYX_USE_C99_COMPLEX
 
493
 
 
494
    typedef double _Complex __pyx_t_double_complex;
 
495
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
 
496
      return x + y*(__pyx_t_double_complex)_Complex_I;
 
497
    }
 
498
    
 
499
    #define __pyx_t_double_complex_is_zero(a) ((a) == 0)
 
500
    #define __pyx_t_double_complex_eq(a, b) ((a) == (b))
 
501
    #define __pyx_t_double_complex_add(a, b) ((a)+(b))
 
502
    #define __pyx_t_double_complex_sub(a, b) ((a)-(b))
 
503
    #define __pyx_t_double_complex_mul(a, b) ((a)*(b))
 
504
    #define __pyx_t_double_complex_div(a, b) ((a)/(b))
 
505
    #define __pyx_t_double_complex_neg(a) (-(a))
 
506
 
 
507
#else
 
508
 
 
509
    typedef struct { double real, imag; } __pyx_t_double_complex;
 
510
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
 
511
      __pyx_t_double_complex c; c.real = x; c.imag = y; return c;
 
512
    }
 
513
    
 
514
    static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) {
 
515
       return (a.real == 0) & (a.imag == 0);
 
516
    }
 
517
 
 
518
    static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
 
519
       return (a.real == b.real) & (a.imag == b.imag);
 
520
    }
 
521
 
 
522
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__pyx_t_double_complex a, __pyx_t_double_complex b) {
 
523
        __pyx_t_double_complex z;
 
524
        z.real = a.real + b.real;
 
525
        z.imag = a.imag + b.imag;
 
526
        return z;
 
527
    }
 
528
 
 
529
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__pyx_t_double_complex a, __pyx_t_double_complex b) {
 
530
        __pyx_t_double_complex z;
 
531
        z.real = a.real - b.real;
 
532
        z.imag = a.imag - b.imag;
 
533
        return z;
 
534
    }
 
535
 
 
536
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__pyx_t_double_complex a, __pyx_t_double_complex b) {
 
537
        __pyx_t_double_complex z;
 
538
        z.real = a.real * b.real - a.imag * b.imag;
 
539
        z.imag = a.real * b.imag + a.imag * b.real;
 
540
        return z;
 
541
    }
 
542
 
 
543
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__pyx_t_double_complex a, __pyx_t_double_complex b) {
 
544
        __pyx_t_double_complex z;
 
545
        double denom = b.real*b.real + b.imag*b.imag;
 
546
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
 
547
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
 
548
        return z;
 
549
    }
 
550
 
 
551
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) {
 
552
        __pyx_t_double_complex z;
 
553
        z.real = -a.real;
 
554
        z.imag = -a.imag;
 
555
        return z;
 
556
    }
 
557
 
 
558
#endif
 
559
 
 
560
#if __PYX_USE_C99_COMPLEX
 
561
 
 
562
    typedef long double _Complex __pyx_t_long__double_complex;
 
563
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) {
 
564
      return x + y*(__pyx_t_long__double_complex)_Complex_I;
 
565
    }
 
566
    
 
567
    #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0)
 
568
    #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b))
 
569
    #define __pyx_t_long__double_complex_add(a, b) ((a)+(b))
 
570
    #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b))
 
571
    #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b))
 
572
    #define __pyx_t_long__double_complex_div(a, b) ((a)/(b))
 
573
    #define __pyx_t_long__double_complex_neg(a) (-(a))
 
574
 
 
575
#else
 
576
 
 
577
    typedef struct { long double real, imag; } __pyx_t_long__double_complex;
 
578
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) {
 
579
      __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c;
 
580
    }
 
581
    
 
582
    static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) {
 
583
       return (a.real == 0) & (a.imag == 0);
 
584
    }
 
585
 
 
586
    static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
 
587
       return (a.real == b.real) & (a.imag == b.imag);
 
588
    }
 
589
 
 
590
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
 
591
        __pyx_t_long__double_complex z;
 
592
        z.real = a.real + b.real;
 
593
        z.imag = a.imag + b.imag;
 
594
        return z;
 
595
    }
 
596
 
 
597
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
 
598
        __pyx_t_long__double_complex z;
 
599
        z.real = a.real - b.real;
 
600
        z.imag = a.imag - b.imag;
 
601
        return z;
 
602
    }
 
603
 
 
604
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
 
605
        __pyx_t_long__double_complex z;
 
606
        z.real = a.real * b.real - a.imag * b.imag;
 
607
        z.imag = a.real * b.imag + a.imag * b.real;
 
608
        return z;
 
609
    }
 
610
 
 
611
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
 
612
        __pyx_t_long__double_complex z;
 
613
        long double denom = b.real*b.real + b.imag*b.imag;
 
614
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
 
615
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
 
616
        return z;
 
617
    }
 
618
 
 
619
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) {
 
620
        __pyx_t_long__double_complex z;
 
621
        z.real = -a.real;
 
622
        z.imag = -a.imag;
 
623
        return z;
 
624
    }
 
625
 
 
626
#endif
 
627
 
 
628
static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
 
629
 
 
630
static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
 
631
 
 
632
static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
 
633
 
 
634
static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
 
635
 
 
636
static INLINE char __Pyx_PyInt_AsChar(PyObject *);
 
637
 
 
638
static INLINE short __Pyx_PyInt_AsShort(PyObject *);
 
639
 
 
640
static INLINE int __Pyx_PyInt_AsInt(PyObject *);
 
641
 
 
642
static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
 
643
 
 
644
static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
 
645
 
 
646
static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
 
647
 
 
648
static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
 
649
 
 
650
static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
 
651
 
 
652
static INLINE long __Pyx_PyInt_AsLong(PyObject *);
 
653
 
 
654
static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
 
655
 
 
656
static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
657
 
 
658
static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
659
 
 
660
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size);  /*proto*/
 
661
 
 
662
static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
663
 
 
664
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
 
665
 
 
666
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
667
 
 
668
/* Type declarations */
 
669
 
 
670
typedef npy_int8 __pyx_t_5numpy_int8_t;
 
671
 
 
672
typedef npy_int16 __pyx_t_5numpy_int16_t;
 
673
 
 
674
typedef npy_int32 __pyx_t_5numpy_int32_t;
 
675
 
 
676
typedef npy_int64 __pyx_t_5numpy_int64_t;
 
677
 
 
678
typedef npy_uint8 __pyx_t_5numpy_uint8_t;
 
679
 
 
680
typedef npy_uint16 __pyx_t_5numpy_uint16_t;
 
681
 
 
682
typedef npy_uint32 __pyx_t_5numpy_uint32_t;
 
683
 
 
684
typedef npy_uint64 __pyx_t_5numpy_uint64_t;
 
685
 
 
686
typedef npy_float32 __pyx_t_5numpy_float32_t;
 
687
 
 
688
typedef npy_float64 __pyx_t_5numpy_float64_t;
 
689
 
 
690
typedef npy_complex64 __pyx_t_5numpy_complex64_t;
 
691
 
 
692
typedef npy_complex128 __pyx_t_5numpy_complex128_t;
 
693
 
 
694
typedef npy_long __pyx_t_5numpy_int_t;
 
695
 
 
696
typedef npy_longlong __pyx_t_5numpy_long_t;
 
697
 
 
698
typedef npy_ulong __pyx_t_5numpy_uint_t;
 
699
 
 
700
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
 
701
 
 
702
typedef npy_double __pyx_t_5numpy_float_t;
 
703
 
 
704
typedef npy_double __pyx_t_5numpy_double_t;
 
705
 
 
706
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
 
707
 
 
708
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
 
709
 
 
710
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
 
711
 
 
712
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
 
713
 
 
714
typedef npy_cdouble __pyx_t_5numpy_complex_t;
 
715
 
 
716
typedef double (*__pyx_t_7tseries_double_func)(double, double);
 
717
/* Module declarations from numpy */
 
718
 
 
719
/* Module declarations from datetime */
 
720
 
 
721
/* Module declarations from python_buffer */
 
722
 
 
723
/* Module declarations from stdlib */
 
724
 
 
725
/* Module declarations from numpy */
 
726
 
 
727
/* Module declarations from numpy */
 
728
 
 
729
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
 
730
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
 
731
static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
 
732
/* Module declarations from python_dict */
 
733
 
 
734
/* Module declarations from cython */
 
735
 
 
736
/* Module declarations from tseries */
 
737
 
 
738
static PyTypeObject *__pyx_ptype_7tseries_dtype = 0;
 
739
static PyTypeObject *__pyx_ptype_7tseries_ndarray = 0;
 
740
static PyTypeObject *__pyx_ptype_7tseries_flatiter = 0;
 
741
static PyTypeObject *__pyx_ptype_7tseries_broadcast = 0;
 
742
static PyTypeObject *__pyx_ptype_7tseries_datetime = 0;
 
743
static double __pyx_v_7tseries_NaN;
 
744
static double __pyx_v_7tseries_INF;
 
745
static double __pyx_v_7tseries_NEGINF;
 
746
static INLINE PyObject *__pyx_f_7tseries_trycall(PyObject *, PyObject *); /*proto*/
 
747
static INLINE int __pyx_f_7tseries_int_max(int, int); /*proto*/
 
748
static INLINE int __pyx_f_7tseries_int_min(int, int); /*proto*/
 
749
static PyObject *__pyx_f_7tseries__nofill(PyArrayObject *, PyArrayObject *, PyObject *, PyObject *); /*proto*/
 
750
static PyObject *__pyx_f_7tseries__backfill(PyArrayObject *, PyArrayObject *, PyObject *, PyObject *); /*proto*/
 
751
static PyObject *__pyx_f_7tseries__pad(PyArrayObject *, PyArrayObject *, PyObject *, PyObject *); /*proto*/
 
752
static INLINE PyObject *__pyx_f_7tseries__checknull(PyObject *); /*proto*/
 
753
static PyArrayObject *__pyx_f_7tseries__isnullobj(PyObject *); /*proto*/
 
754
static double __pyx_f_7tseries___add(double, double); /*proto*/
 
755
static double __pyx_f_7tseries___sub(double, double); /*proto*/
 
756
static double __pyx_f_7tseries___div(double, double); /*proto*/
 
757
static double __pyx_f_7tseries___mul(double, double); /*proto*/
 
758
static double __pyx_f_7tseries___eq(double, double); /*proto*/
 
759
static double __pyx_f_7tseries___ne(double, double); /*proto*/
 
760
static double __pyx_f_7tseries___lt(double, double); /*proto*/
 
761
static double __pyx_f_7tseries___gt(double, double); /*proto*/
 
762
static double __pyx_f_7tseries___pow(double, double); /*proto*/
 
763
static PyArrayObject *__pyx_f_7tseries__applyFunc(__pyx_t_7tseries_double_func, PyArrayObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
 
764
static __Pyx_TypeInfo __Pyx_TypeInfo_object = { "Python object", NULL, sizeof(PyObject *), 'O' };
 
765
static __Pyx_TypeInfo __Pyx_TypeInfo_nn_npy_int8 = { "numpy.npy_int8", NULL, sizeof(npy_int8), 'I' };
 
766
static __Pyx_TypeInfo __Pyx_TypeInfo_nn_npy_float64 = { "numpy.npy_float64", NULL, sizeof(npy_float64), 'R' };
 
767
#define __Pyx_MODULE_NAME "tseries"
 
768
int __pyx_module_is_main_tseries = 0;
 
769
 
 
770
/* Implementation of tseries */
 
771
static PyObject *__pyx_int_1;
 
772
static char __pyx_k___main__[] = "__main__";
 
773
static PyObject *__pyx_kp___main__;
 
774
static char __pyx_k_index[] = "index";
 
775
static PyObject *__pyx_kp_index;
 
776
static char __pyx_k_A[] = "A";
 
777
static PyObject *__pyx_kp_A;
 
778
static char __pyx_k_B[] = "B";
 
779
static PyObject *__pyx_kp_B;
 
780
static char __pyx_k_arr[] = "arr";
 
781
static PyObject *__pyx_kp_arr;
 
782
static char __pyx_k_idxMap[] = "idxMap";
 
783
static PyObject *__pyx_kp_idxMap;
 
784
static char __pyx_k_oldIndex[] = "oldIndex";
 
785
static PyObject *__pyx_kp_oldIndex;
 
786
static char __pyx_k_newIndex[] = "newIndex";
 
787
static PyObject *__pyx_kp_newIndex;
 
788
static char __pyx_k_oldMap[] = "oldMap";
 
789
static PyObject *__pyx_kp_oldMap;
 
790
static char __pyx_k_newMap[] = "newMap";
 
791
static PyObject *__pyx_kp_newMap;
 
792
static char __pyx_k_kind[] = "kind";
 
793
static PyObject *__pyx_kp_kind;
 
794
static char __pyx_k_values[] = "values";
 
795
static PyObject *__pyx_kp_values;
 
796
static char __pyx_k_indexMap[] = "indexMap";
 
797
static PyObject *__pyx_kp_indexMap;
 
798
static char __pyx_k_input[] = "input";
 
799
static PyObject *__pyx_kp_input;
 
800
static char __pyx_k_name[] = "name";
 
801
static PyObject *__pyx_kp_name;
 
802
static char __pyx_k_ao[] = "ao";
 
803
static PyObject *__pyx_kp_ao;
 
804
static char __pyx_k_bo[] = "bo";
 
805
static PyObject *__pyx_kp_bo;
 
806
static char __pyx_k_aMap[] = "aMap";
 
807
static PyObject *__pyx_kp_aMap;
 
808
static char __pyx_k_bMap[] = "bMap";
 
809
static PyObject *__pyx_kp_bMap;
 
810
static char __pyx_k_func[] = "func";
 
811
static PyObject *__pyx_kp_func;
 
812
static char __pyx_k_keyfunc[] = "keyfunc";
 
813
static PyObject *__pyx_kp_keyfunc;
 
814
static char __pyx_k_applyfunc[] = "applyfunc";
 
815
static PyObject *__pyx_kp_applyfunc;
 
816
static char __pyx_k_numpy[] = "numpy";
 
817
static PyObject *__pyx_kp_numpy;
 
818
static char __pyx_k_np[] = "np";
 
819
static PyObject *__pyx_kp_np;
 
820
static char __pyx_k_isnan[] = "isnan";
 
821
static PyObject *__pyx_kp_isnan;
 
822
static char __pyx_k_NaN[] = "NaN";
 
823
static PyObject *__pyx_kp_NaN;
 
824
static char __pyx_k_datetime[] = "datetime";
 
825
static PyObject *__pyx_kp_datetime;
 
826
static char __pyx_k_pydatetime[] = "pydatetime";
 
827
static PyObject *__pyx_kp_pydatetime;
 
828
static char __pyx_k_inf[] = "inf";
 
829
static PyObject *__pyx_kp_inf;
 
830
static char __pyx_k_Exception[] = "Exception";
 
831
static PyObject *__pyx_kp_Exception;
 
832
static char __pyx_k_map_indices[] = "map_indices";
 
833
static PyObject *__pyx_kp_map_indices;
 
834
static char __pyx_k_empty[] = "empty";
 
835
static PyObject *__pyx_kp_empty;
 
836
static char __pyx_k_32[] = "float64";
 
837
static PyObject *__pyx_kp_32;
 
838
static char __pyx_k_astype[] = "astype";
 
839
static PyObject *__pyx_kp_astype;
 
840
static char __pyx_k_dtype[] = "dtype";
 
841
static PyObject *__pyx_kp_dtype;
 
842
static char __pyx_k_object_[] = "object_";
 
843
static PyObject *__pyx_kp_object_;
 
844
static char __pyx_k_object[] = "object";
 
845
static PyObject *__pyx_kp_object;
 
846
static char __pyx_k_33[] = "int32";
 
847
static PyObject *__pyx_kp_33;
 
848
static char __pyx_k_zeros[] = "zeros";
 
849
static PyObject *__pyx_kp_zeros;
 
850
static char __pyx_k_34[] = "int8";
 
851
static PyObject *__pyx_kp_34;
 
852
static char __pyx_k_36[] = "PAD";
 
853
static PyObject *__pyx_kp_36;
 
854
static char __pyx_k_37[] = "BACKFILL";
 
855
static PyObject *__pyx_kp_37;
 
856
static char __pyx_k_bool[] = "bool";
 
857
static PyObject *__pyx_kp_bool;
 
858
static char __pyx_k_38[] = "O";
 
859
static PyObject *__pyx_kp_38;
 
860
static char __pyx_k_39[] = "S";
 
861
static PyObject *__pyx_kp_39;
 
862
static char __pyx_k_isfinite[] = "isfinite";
 
863
static PyObject *__pyx_kp_isfinite;
 
864
static char __pyx_k_isnull[] = "isnull";
 
865
static PyObject *__pyx_kp_isnull;
 
866
static char __pyx_k_40[] = "__add__";
 
867
static PyObject *__pyx_kp_40;
 
868
static char __pyx_k_41[] = "__sub__";
 
869
static PyObject *__pyx_kp_41;
 
870
static char __pyx_k_42[] = "__div__";
 
871
static PyObject *__pyx_kp_42;
 
872
static char __pyx_k_43[] = "__mul__";
 
873
static PyObject *__pyx_kp_43;
 
874
static char __pyx_k_44[] = "__eq__";
 
875
static PyObject *__pyx_kp_44;
 
876
static char __pyx_k_45[] = "__ne__";
 
877
static PyObject *__pyx_kp_45;
 
878
static char __pyx_k_46[] = "__lt__";
 
879
static PyObject *__pyx_kp_46;
 
880
static char __pyx_k_47[] = "__gt__";
 
881
static PyObject *__pyx_kp_47;
 
882
static char __pyx_k_48[] = "__pow__";
 
883
static PyObject *__pyx_kp_48;
 
884
static char __pyx_k_arrmap[] = "arrmap";
 
885
static PyObject *__pyx_kp_arrmap;
 
886
static char __pyx_k_asarray[] = "asarray";
 
887
static PyObject *__pyx_kp_asarray;
 
888
static char __pyx_k_any[] = "any";
 
889
static PyObject *__pyx_kp_any;
 
890
static PyObject *__pyx_builtin_Exception;
 
891
static PyObject *__pyx_builtin_object;
 
892
static PyObject *__pyx_kp_31;
 
893
static char __pyx_k_31[] = "Error calling func on index %s";
 
894
static PyObject *__pyx_kp_35;
 
895
static char __pyx_k_35[] = "";
 
896
static PyObject *__pyx_kp_49;
 
897
static char __pyx_k_49[] = "bad funcname requested of Cython code";
 
898
static PyObject *__pyx_kp_50;
 
899
static char __pyx_k_50[] = "Dates and values were not the same length!";
 
900
static PyObject *__pyx_kp_51;
 
901
static char __pyx_k_51[] = "Dates and values were not the same length!";
 
902
static PyObject *__pyx_kp_52;
 
903
static char __pyx_k_52[] = "Dates and values were not the same length!";
 
904
static PyObject *__pyx_kp_53;
 
905
static char __pyx_k_53[] = "Dates and values were not the same length!";
 
906
static PyObject *__pyx_int_15;
 
907
static char __pyx_k___getbuffer__[] = "__getbuffer__";
 
908
static PyObject *__pyx_kp___getbuffer__;
 
909
static char __pyx_k___releasebuffer__[] = "__releasebuffer__";
 
910
static PyObject *__pyx_kp___releasebuffer__;
 
911
static char __pyx_k_info[] = "info";
 
912
static PyObject *__pyx_kp_info;
 
913
static char __pyx_k_flags[] = "flags";
 
914
static PyObject *__pyx_kp_flags;
 
915
static char __pyx_k_ValueError[] = "ValueError";
 
916
static PyObject *__pyx_kp_ValueError;
 
917
static char __pyx_k_range[] = "range";
 
918
static PyObject *__pyx_kp_range;
 
919
static char __pyx_k_itervalues[] = "itervalues";
 
920
static PyObject *__pyx_kp_itervalues;
 
921
static char __pyx_k_RuntimeError[] = "RuntimeError";
 
922
static PyObject *__pyx_kp_RuntimeError;
 
923
static PyObject *__pyx_kp_1;
 
924
static PyObject *__pyx_kp_2;
 
925
static PyObject *__pyx_kp_5;
 
926
static PyObject *__pyx_kp_23;
 
927
static PyObject *__pyx_builtin_ValueError;
 
928
static PyObject *__pyx_builtin_range;
 
929
static PyObject *__pyx_builtin_RuntimeError;
 
930
static char __pyx_k_1[] = "ndarray is not C contiguous";
 
931
static char __pyx_k_2[] = "ndarray is not Fortran contiguous";
 
932
static char __pyx_k_3[] = ">";
 
933
static char __pyx_k_4[] = "<";
 
934
static char __pyx_k_5[] = "Non-native byte order not supported";
 
935
static char __pyx_k_6[] = "b";
 
936
static char __pyx_k_7[] = "B";
 
937
static char __pyx_k_8[] = "h";
 
938
static char __pyx_k_9[] = "H";
 
939
static char __pyx_k_10[] = "i";
 
940
static char __pyx_k_11[] = "I";
 
941
static char __pyx_k_12[] = "l";
 
942
static char __pyx_k_13[] = "L";
 
943
static char __pyx_k_14[] = "q";
 
944
static char __pyx_k_15[] = "Q";
 
945
static char __pyx_k_16[] = "f";
 
946
static char __pyx_k_17[] = "d";
 
947
static char __pyx_k_18[] = "g";
 
948
static char __pyx_k_19[] = "Zf";
 
949
static char __pyx_k_20[] = "Zd";
 
950
static char __pyx_k_21[] = "Zg";
 
951
static char __pyx_k_22[] = "O";
 
952
static char __pyx_k_23[] = "unknown dtype code in numpy.pxd (%d)";
 
953
static char __pyx_k_24[] = "^";
 
954
static PyObject *__pyx_kp_25;
 
955
static PyObject *__pyx_kp_28;
 
956
static PyObject *__pyx_kp_29;
 
957
static PyObject *__pyx_kp_30;
 
958
static char __pyx_k_25[] = "Format string allocated too short, see comment in numpy.pxd";
 
959
static char __pyx_k_26[] = ">";
 
960
static char __pyx_k_27[] = "<";
 
961
static char __pyx_k_28[] = "Non-native byte order not supported";
 
962
static char __pyx_k_29[] = "Format string allocated too short.";
 
963
static char __pyx_k_30[] = "unknown dtype code in numpy.pxd (%d)";
 
964
 
 
965
/* "pandas/lib/src/tseries.pyx":21
 
966
 * cimport cython
 
967
 * 
 
968
 * cdef inline object trycall(object func, object arg):             # <<<<<<<<<<<<<<
 
969
 *     cdef object result
 
970
 *     try:
 
971
 */
 
972
 
 
973
static INLINE PyObject *__pyx_f_7tseries_trycall(PyObject *__pyx_v_func, PyObject *__pyx_v_arg) {
 
974
  PyObject *__pyx_v_result;
 
975
  PyObject *__pyx_r = NULL;
 
976
  PyObject *__pyx_t_1 = NULL;
 
977
  PyObject *__pyx_t_2 = NULL;
 
978
  PyObject *__pyx_t_3 = NULL;
 
979
  PyObject *__pyx_t_4 = NULL;
 
980
  PyObject *__pyx_t_5 = NULL;
 
981
  __Pyx_SetupRefcountContext("trycall");
 
982
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);
 
983
 
 
984
  /* "pandas/lib/src/tseries.pyx":23
 
985
 * cdef inline object trycall(object func, object arg):
 
986
 *     cdef object result
 
987
 *     try:             # <<<<<<<<<<<<<<
 
988
 *         result = func(arg)
 
989
 *     except:
 
990
 */
 
991
  {
 
992
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
 
993
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
 
994
    __Pyx_XGOTREF(__pyx_save_exc_type);
 
995
    __Pyx_XGOTREF(__pyx_save_exc_value);
 
996
    __Pyx_XGOTREF(__pyx_save_exc_tb);
 
997
    /*try:*/ {
 
998
 
 
999
      /* "pandas/lib/src/tseries.pyx":24
 
1000
 *     cdef object result
 
1001
 *     try:
 
1002
 *         result = func(arg)             # <<<<<<<<<<<<<<
 
1003
 *     except:
 
1004
 *         raise Exception('Error calling func on index %s' % arg)
 
1005
 */
 
1006
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1007
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
1008
      __Pyx_INCREF(__pyx_v_arg);
 
1009
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arg);
 
1010
      __Pyx_GIVEREF(__pyx_v_arg);
 
1011
      __pyx_t_2 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1012
      __Pyx_GOTREF(__pyx_t_2);
 
1013
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
1014
      __Pyx_DECREF(__pyx_v_result);
 
1015
      __pyx_v_result = __pyx_t_2;
 
1016
      __pyx_t_2 = 0;
 
1017
    }
 
1018
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
 
1019
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
 
1020
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
 
1021
    goto __pyx_L10_try_end;
 
1022
    __pyx_L3_error:;
 
1023
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
1024
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1025
 
 
1026
    /* "pandas/lib/src/tseries.pyx":25
 
1027
 *     try:
 
1028
 *         result = func(arg)
 
1029
 *     except:             # <<<<<<<<<<<<<<
 
1030
 *         raise Exception('Error calling func on index %s' % arg)
 
1031
 *     return result
 
1032
 */
 
1033
    /*except:*/ {
 
1034
      __Pyx_AddTraceback("tseries.trycall");
 
1035
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
 
1036
      __Pyx_GOTREF(__pyx_t_2);
 
1037
      __Pyx_GOTREF(__pyx_t_1);
 
1038
      __Pyx_GOTREF(__pyx_t_3);
 
1039
 
 
1040
      /* "pandas/lib/src/tseries.pyx":26
 
1041
 *         result = func(arg)
 
1042
 *     except:
 
1043
 *         raise Exception('Error calling func on index %s' % arg)             # <<<<<<<<<<<<<<
 
1044
 *     return result
 
1045
 * 
 
1046
 */
 
1047
      __pyx_t_4 = PyNumber_Remainder(__pyx_kp_31, __pyx_v_arg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
 
1048
      __Pyx_GOTREF(__pyx_t_4);
 
1049
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
 
1050
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
1051
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
 
1052
      __Pyx_GIVEREF(__pyx_t_4);
 
1053
      __pyx_t_4 = 0;
 
1054
      __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
 
1055
      __Pyx_GOTREF(__pyx_t_4);
 
1056
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
1057
      __Pyx_Raise(__pyx_t_4, 0, 0);
 
1058
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1059
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
 
1060
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1061
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
1062
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
1063
      goto __pyx_L4_exception_handled;
 
1064
    }
 
1065
    __pyx_L5_except_error:;
 
1066
    __Pyx_XDECREF(__pyx_save_exc_type);
 
1067
    __Pyx_XDECREF(__pyx_save_exc_value);
 
1068
    __Pyx_XDECREF(__pyx_save_exc_tb);
 
1069
    goto __pyx_L1_error;
 
1070
    __pyx_L4_exception_handled:;
 
1071
    __Pyx_XGIVEREF(__pyx_save_exc_type);
 
1072
    __Pyx_XGIVEREF(__pyx_save_exc_value);
 
1073
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
 
1074
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
 
1075
    __pyx_L10_try_end:;
 
1076
  }
 
1077
 
 
1078
  /* "pandas/lib/src/tseries.pyx":27
 
1079
 *     except:
 
1080
 *         raise Exception('Error calling func on index %s' % arg)
 
1081
 *     return result             # <<<<<<<<<<<<<<
 
1082
 * 
 
1083
 * cdef inline int int_max(int a, int b): return a if a >= b else b
 
1084
 */
 
1085
  __Pyx_XDECREF(__pyx_r);
 
1086
  __Pyx_INCREF(__pyx_v_result);
 
1087
  __pyx_r = __pyx_v_result;
 
1088
  goto __pyx_L0;
 
1089
 
 
1090
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
1091
  goto __pyx_L0;
 
1092
  __pyx_L1_error:;
 
1093
  __Pyx_XDECREF(__pyx_t_1);
 
1094
  __Pyx_XDECREF(__pyx_t_2);
 
1095
  __Pyx_XDECREF(__pyx_t_3);
 
1096
  __Pyx_XDECREF(__pyx_t_4);
 
1097
  __Pyx_XDECREF(__pyx_t_5);
 
1098
  __Pyx_AddTraceback("tseries.trycall");
 
1099
  __pyx_r = 0;
 
1100
  __pyx_L0:;
 
1101
  __Pyx_DECREF(__pyx_v_result);
 
1102
  __Pyx_XGIVEREF(__pyx_r);
 
1103
  __Pyx_FinishRefcountContext();
 
1104
  return __pyx_r;
 
1105
}
 
1106
 
 
1107
/* "pandas/lib/src/tseries.pyx":29
 
1108
 *     return result
 
1109
 * 
 
1110
 * cdef inline int int_max(int a, int b): return a if a >= b else b             # <<<<<<<<<<<<<<
 
1111
 * cdef inline int int_min(int a, int b): return a if a >= b else b
 
1112
 * 
 
1113
 */
 
1114
 
 
1115
static INLINE int __pyx_f_7tseries_int_max(int __pyx_v_a, int __pyx_v_b) {
 
1116
  int __pyx_r;
 
1117
  int __pyx_1;
 
1118
  __Pyx_SetupRefcountContext("int_max");
 
1119
  if ((__pyx_v_a >= __pyx_v_b)) {
 
1120
    __pyx_1 = __pyx_v_a;
 
1121
  } else {
 
1122
    __pyx_1 = __pyx_v_b;
 
1123
  }
 
1124
  __pyx_r = __pyx_1;
 
1125
  goto __pyx_L0;
 
1126
 
 
1127
  __pyx_r = 0;
 
1128
  __pyx_L0:;
 
1129
  __Pyx_FinishRefcountContext();
 
1130
  return __pyx_r;
 
1131
}
 
1132
 
 
1133
/* "pandas/lib/src/tseries.pyx":30
 
1134
 * 
 
1135
 * cdef inline int int_max(int a, int b): return a if a >= b else b
 
1136
 * cdef inline int int_min(int a, int b): return a if a >= b else b             # <<<<<<<<<<<<<<
 
1137
 * 
 
1138
 * def map_indices(ndarray index):
 
1139
 */
 
1140
 
 
1141
static INLINE int __pyx_f_7tseries_int_min(int __pyx_v_a, int __pyx_v_b) {
 
1142
  int __pyx_r;
 
1143
  int __pyx_1;
 
1144
  __Pyx_SetupRefcountContext("int_min");
 
1145
  if ((__pyx_v_a >= __pyx_v_b)) {
 
1146
    __pyx_1 = __pyx_v_a;
 
1147
  } else {
 
1148
    __pyx_1 = __pyx_v_b;
 
1149
  }
 
1150
  __pyx_r = __pyx_1;
 
1151
  goto __pyx_L0;
 
1152
 
 
1153
  __pyx_r = 0;
 
1154
  __pyx_L0:;
 
1155
  __Pyx_FinishRefcountContext();
 
1156
  return __pyx_r;
 
1157
}
 
1158
 
 
1159
/* "pandas/lib/src/tseries.pyx":32
 
1160
 * cdef inline int int_min(int a, int b): return a if a >= b else b
 
1161
 * 
 
1162
 * def map_indices(ndarray index):             # <<<<<<<<<<<<<<
 
1163
 *     '''
 
1164
 *     Produce a dict mapping the values of the input array to their respective
 
1165
 */
 
1166
 
 
1167
static PyObject *__pyx_pf_7tseries_map_indices(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
 
1168
static char __pyx_doc_7tseries_map_indices[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n    \n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n        \n    Better to do this with Cython because of the enormous speed boost.\n    ";
 
1169
static PyObject *__pyx_pf_7tseries_map_indices(PyObject *__pyx_self, PyObject *__pyx_v_index) {
 
1170
  int __pyx_v_i;
 
1171
  int __pyx_v_length;
 
1172
  PyArrayIterObject *__pyx_v_iter;
 
1173
  PyObject *__pyx_v_result;
 
1174
  PyObject *__pyx_v_idx;
 
1175
  PyObject *__pyx_r = NULL;
 
1176
  PyObject *__pyx_1 = 0;
 
1177
  PyObject *__pyx_t_1 = NULL;
 
1178
  int __pyx_t_2;
 
1179
  __Pyx_SetupRefcountContext("map_indices");
 
1180
  __pyx_self = __pyx_self;
 
1181
  __pyx_v_iter = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
1182
  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
1183
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
1184
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1185
 
 
1186
  /* "pandas/lib/src/tseries.pyx":47
 
1187
 *     cdef object idx
 
1188
 * 
 
1189
 *     result = {}             # <<<<<<<<<<<<<<
 
1190
 * 
 
1191
 *     iter = PyArray_IterNew(index)
 
1192
 */
 
1193
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1194
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
1195
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
1196
  __pyx_v_result = __pyx_1;
 
1197
  __pyx_1 = 0;
 
1198
 
 
1199
  /* "pandas/lib/src/tseries.pyx":49
 
1200
 *     result = {}
 
1201
 * 
 
1202
 *     iter = PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 
1203
 * 
 
1204
 *     length = PyArray_SIZE(index)
 
1205
 */
 
1206
  __pyx_t_1 = PyArray_IterNew(__pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1207
  __Pyx_GOTREF(__pyx_t_1);
 
1208
  if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1209
  __Pyx_DECREF(((PyObject *)__pyx_v_iter));
 
1210
  __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_1);
 
1211
  __pyx_t_1 = 0;
 
1212
 
 
1213
  /* "pandas/lib/src/tseries.pyx":51
 
1214
 *     iter = PyArray_IterNew(index)
 
1215
 * 
 
1216
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 
1217
 * 
 
1218
 *     for i from 0 <= i < length:
 
1219
 */
 
1220
  if (!(__Pyx_TypeTest(__pyx_v_index, __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1221
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_index));
 
1222
 
 
1223
  /* "pandas/lib/src/tseries.pyx":53
 
1224
 *     length = PyArray_SIZE(index)
 
1225
 * 
 
1226
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
1227
 *         idx = PyArray_GETITEM(index, <void *> iter.dataptr)
 
1228
 *         result[idx] = i
 
1229
 */
 
1230
  __pyx_t_2 = __pyx_v_length;
 
1231
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
 
1232
 
 
1233
    /* "pandas/lib/src/tseries.pyx":54
 
1234
 * 
 
1235
 *     for i from 0 <= i < length:
 
1236
 *         idx = PyArray_GETITEM(index, <void *> iter.dataptr)             # <<<<<<<<<<<<<<
 
1237
 *         result[idx] = i
 
1238
 *         PyArray_ITER_NEXT(iter)
 
1239
 */
 
1240
    __pyx_t_1 = PyArray_GETITEM(__pyx_v_index, ((void *)__pyx_v_iter->dataptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1241
    __Pyx_GOTREF(__pyx_t_1);
 
1242
    __Pyx_DECREF(__pyx_v_idx);
 
1243
    __pyx_v_idx = __pyx_t_1;
 
1244
    __pyx_t_1 = 0;
 
1245
 
 
1246
    /* "pandas/lib/src/tseries.pyx":55
 
1247
 *     for i from 0 <= i < length:
 
1248
 *         idx = PyArray_GETITEM(index, <void *> iter.dataptr)
 
1249
 *         result[idx] = i             # <<<<<<<<<<<<<<
 
1250
 *         PyArray_ITER_NEXT(iter)
 
1251
 * 
 
1252
 */
 
1253
    __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1254
    __Pyx_GOTREF(__pyx_t_1);
 
1255
    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1256
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
1257
 
 
1258
    /* "pandas/lib/src/tseries.pyx":56
 
1259
 *         idx = PyArray_GETITEM(index, <void *> iter.dataptr)
 
1260
 *         result[idx] = i
 
1261
 *         PyArray_ITER_NEXT(iter)             # <<<<<<<<<<<<<<
 
1262
 * 
 
1263
 *     return result
 
1264
 */
 
1265
    PyArray_ITER_NEXT(__pyx_v_iter);
 
1266
  }
 
1267
 
 
1268
  /* "pandas/lib/src/tseries.pyx":58
 
1269
 *         PyArray_ITER_NEXT(iter)
 
1270
 * 
 
1271
 *     return result             # <<<<<<<<<<<<<<
 
1272
 * 
 
1273
 * def match(ndarray A, ndarray B):
 
1274
 */
 
1275
  __Pyx_XDECREF(__pyx_r);
 
1276
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
1277
  __pyx_r = ((PyObject *)__pyx_v_result);
 
1278
  goto __pyx_L0;
 
1279
 
 
1280
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
1281
  goto __pyx_L0;
 
1282
  __pyx_L1_error:;
 
1283
  __Pyx_XDECREF(__pyx_1);
 
1284
  __Pyx_XDECREF(__pyx_t_1);
 
1285
  __Pyx_AddTraceback("tseries.map_indices");
 
1286
  __pyx_r = NULL;
 
1287
  __pyx_L0:;
 
1288
  __Pyx_DECREF((PyObject *)__pyx_v_iter);
 
1289
  __Pyx_DECREF(__pyx_v_result);
 
1290
  __Pyx_DECREF(__pyx_v_idx);
 
1291
  __Pyx_XGIVEREF(__pyx_r);
 
1292
  __Pyx_FinishRefcountContext();
 
1293
  return __pyx_r;
 
1294
}
 
1295
 
 
1296
/* "pandas/lib/src/tseries.pyx":60
 
1297
 *     return result
 
1298
 * 
 
1299
 * def match(ndarray A, ndarray B):             # <<<<<<<<<<<<<<
 
1300
 *     '''
 
1301
 *     --> match(a, b)
 
1302
 */
 
1303
 
 
1304
static PyObject *__pyx_pf_7tseries_match(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
1305
static char __pyx_doc_7tseries_match[] = "\n    --> match(a, b)\n    \n    Close equivalent of R's match function.\n    \n    For given input index A, find matching locations for values of A in B.\n    \n    Example:\n    >>> b\n    array([[ 0.        ,  0.26929312],\n           [ 1.        ,  0.49540359],\n           [ 2.        ,  0.66389941],\n           [ 3.        ,  0.66235806],\n           [ 4.        ,  0.97993956],\n           [ 5.        ,  0.83804732],\n           [ 6.        ,  0.75033074],\n           [ 7.        ,  0.10250388],\n           [ 8.        ,  0.66591799],\n           [ 9.        ,  0.18337242]])\n    >>> a\n        array([1, 3, 6, 8, 4, 5, 7, 0, 2, 9])\n    \n    # Now with match we can realign b based on a\n    \n    >>> b[match(a, b[:,0]),:]\n    array([[ 1.        ,  0.49540359],\n           [ 3.        ,  0.66235806],\n           [ 6.        ,  0.75033074],\n           [ 8.        ,  0.66591799],\n           [ 4.        ,  0.97993956],\n           [ 5.        ,  0.83804732],\n           [ 7.        ,  0.10250388],\n           [ 0.        ,  0.26929312],\n           [ 2.        ,  0.66389941],\n           [ 9.        ,  0.18337242]])\n   \n    ";
 
1306
static PyObject *__pyx_pf_7tseries_match(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
1307
  PyArrayObject *__pyx_v_A = 0;
 
1308
  PyArrayObject *__pyx_v_B = 0;
 
1309
  int __pyx_v_i;
 
1310
  int __pyx_v_length;
 
1311
  PyArrayIterObject *__pyx_v_itera;
 
1312
  PyObject *__pyx_v_bmap;
 
1313
  double *__pyx_v_result_data;
 
1314
  double __pyx_v_nan;
 
1315
  PyObject *__pyx_v_idx;
 
1316
  PyArrayObject *__pyx_v_result;
 
1317
  PyObject *__pyx_r = NULL;
 
1318
  PyObject *__pyx_1 = 0;
 
1319
  PyObject *__pyx_t_1 = NULL;
 
1320
  double __pyx_t_2;
 
1321
  PyObject *__pyx_t_3 = NULL;
 
1322
  PyObject *__pyx_t_4 = NULL;
 
1323
  PyObject *__pyx_t_5 = NULL;
 
1324
  int __pyx_t_6;
 
1325
  int __pyx_t_7;
 
1326
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_A,&__pyx_kp_B,0};
 
1327
  __Pyx_SetupRefcountContext("match");
 
1328
  __pyx_self = __pyx_self;
 
1329
  if (unlikely(__pyx_kwds)) {
 
1330
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
1331
    PyObject* values[2] = {0,0};
 
1332
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
1333
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
1334
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
1335
      case  0: break;
 
1336
      default: goto __pyx_L5_argtuple_error;
 
1337
    }
 
1338
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
1339
      case  0:
 
1340
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_A);
 
1341
      if (likely(values[0])) kw_args--;
 
1342
      else goto __pyx_L5_argtuple_error;
 
1343
      case  1:
 
1344
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_B);
 
1345
      if (likely(values[1])) kw_args--;
 
1346
      else {
 
1347
        __Pyx_RaiseArgtupleInvalid("match", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1348
      }
 
1349
    }
 
1350
    if (unlikely(kw_args > 0)) {
 
1351
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "match") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1352
    }
 
1353
    __pyx_v_A = ((PyArrayObject *)values[0]);
 
1354
    __pyx_v_B = ((PyArrayObject *)values[1]);
 
1355
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
 
1356
    goto __pyx_L5_argtuple_error;
 
1357
  } else {
 
1358
    __pyx_v_A = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
1359
    __pyx_v_B = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
1360
  }
 
1361
  goto __pyx_L4_argument_unpacking_done;
 
1362
  __pyx_L5_argtuple_error:;
 
1363
  __Pyx_RaiseArgtupleInvalid("match", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1364
  __pyx_L3_error:;
 
1365
  __Pyx_AddTraceback("tseries.match");
 
1366
  return NULL;
 
1367
  __pyx_L4_argument_unpacking_done:;
 
1368
  __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
1369
  __pyx_v_bmap = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
1370
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
1371
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
1372
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_5numpy_ndarray, 1, "A", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1373
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1374
 
 
1375
  /* "pandas/lib/src/tseries.pyx":107
 
1376
 *     cdef ndarray result
 
1377
 * 
 
1378
 *     nan = <double> np.NaN             # <<<<<<<<<<<<<<
 
1379
 * 
 
1380
 *     bmap = map_indices(B)
 
1381
 */
 
1382
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1383
  __Pyx_GOTREF(__pyx_1);
 
1384
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1385
  __Pyx_GOTREF(__pyx_t_1);
 
1386
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1387
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1388
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
1389
  __pyx_v_nan = ((double)__pyx_t_2);
 
1390
 
 
1391
  /* "pandas/lib/src/tseries.pyx":109
 
1392
 *     nan = <double> np.NaN
 
1393
 * 
 
1394
 *     bmap = map_indices(B)             # <<<<<<<<<<<<<<
 
1395
 * 
 
1396
 *     itera = PyArray_IterNew(A)
 
1397
 */
 
1398
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_map_indices); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1399
  __Pyx_GOTREF(__pyx_1);
 
1400
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1401
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
1402
  __Pyx_INCREF(((PyObject *)__pyx_v_B));
 
1403
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_B));
 
1404
  __Pyx_GIVEREF(((PyObject *)__pyx_v_B));
 
1405
  __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1406
  __Pyx_GOTREF(__pyx_t_3);
 
1407
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1408
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
1409
  if (!(likely(PyDict_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected dict, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1410
  __Pyx_DECREF(((PyObject *)__pyx_v_bmap));
 
1411
  __pyx_v_bmap = ((PyObject *)__pyx_t_3);
 
1412
  __pyx_t_3 = 0;
 
1413
 
 
1414
  /* "pandas/lib/src/tseries.pyx":111
 
1415
 *     bmap = map_indices(B)
 
1416
 * 
 
1417
 *     itera = PyArray_IterNew(A)             # <<<<<<<<<<<<<<
 
1418
 *     length = PyArray_SIZE(A)
 
1419
 * 
 
1420
 */
 
1421
  __pyx_t_3 = PyArray_IterNew(((PyObject *)__pyx_v_A)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1422
  __Pyx_GOTREF(__pyx_t_3);
 
1423
  if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1424
  __Pyx_DECREF(((PyObject *)__pyx_v_itera));
 
1425
  __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_3);
 
1426
  __pyx_t_3 = 0;
 
1427
 
 
1428
  /* "pandas/lib/src/tseries.pyx":112
 
1429
 * 
 
1430
 *     itera = PyArray_IterNew(A)
 
1431
 *     length = PyArray_SIZE(A)             # <<<<<<<<<<<<<<
 
1432
 * 
 
1433
 *     result = <ndarray> np.empty(length, np.float64)
 
1434
 */
 
1435
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1436
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_A));
 
1437
 
 
1438
  /* "pandas/lib/src/tseries.pyx":114
 
1439
 *     length = PyArray_SIZE(A)
 
1440
 * 
 
1441
 *     result = <ndarray> np.empty(length, np.float64)             # <<<<<<<<<<<<<<
 
1442
 * 
 
1443
 *     result_data = <double *> result.data
 
1444
 */
 
1445
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1446
  __Pyx_GOTREF(__pyx_1);
 
1447
  __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1448
  __Pyx_GOTREF(__pyx_t_3);
 
1449
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1450
  __pyx_t_1 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1451
  __Pyx_GOTREF(__pyx_t_1);
 
1452
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1453
  __Pyx_GOTREF(__pyx_1);
 
1454
  __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1455
  __Pyx_GOTREF(__pyx_t_4);
 
1456
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1457
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1458
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
1459
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
 
1460
  __Pyx_GIVEREF(__pyx_t_1);
 
1461
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
 
1462
  __Pyx_GIVEREF(__pyx_t_4);
 
1463
  __pyx_t_1 = 0;
 
1464
  __pyx_t_4 = 0;
 
1465
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1466
  __Pyx_GOTREF(__pyx_t_4);
 
1467
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
1468
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
1469
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
1470
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
1471
  __pyx_v_result = ((PyArrayObject *)__pyx_t_4);
 
1472
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1473
 
 
1474
  /* "pandas/lib/src/tseries.pyx":116
 
1475
 *     result = <ndarray> np.empty(length, np.float64)
 
1476
 * 
 
1477
 *     result_data = <double *> result.data             # <<<<<<<<<<<<<<
 
1478
 * 
 
1479
 *     for i from 0 <= i < length:
 
1480
 */
 
1481
  __pyx_v_result_data = ((double *)__pyx_v_result->data);
 
1482
 
 
1483
  /* "pandas/lib/src/tseries.pyx":118
 
1484
 *     result_data = <double *> result.data
 
1485
 * 
 
1486
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
1487
 *         idx = PyArray_GETITEM(A, <void *> itera.dataptr)
 
1488
 *         if idx in bmap:
 
1489
 */
 
1490
  __pyx_t_6 = __pyx_v_length;
 
1491
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
 
1492
 
 
1493
    /* "pandas/lib/src/tseries.pyx":119
 
1494
 * 
 
1495
 *     for i from 0 <= i < length:
 
1496
 *         idx = PyArray_GETITEM(A, <void *> itera.dataptr)             # <<<<<<<<<<<<<<
 
1497
 *         if idx in bmap:
 
1498
 *             result_data[i] = <double> bmap[idx]
 
1499
 */
 
1500
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_A), ((void *)__pyx_v_itera->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1501
    __Pyx_GOTREF(__pyx_t_4);
 
1502
    __Pyx_DECREF(__pyx_v_idx);
 
1503
    __pyx_v_idx = __pyx_t_4;
 
1504
    __pyx_t_4 = 0;
 
1505
 
 
1506
    /* "pandas/lib/src/tseries.pyx":120
 
1507
 *     for i from 0 <= i < length:
 
1508
 *         idx = PyArray_GETITEM(A, <void *> itera.dataptr)
 
1509
 *         if idx in bmap:             # <<<<<<<<<<<<<<
 
1510
 *             result_data[i] = <double> bmap[idx]
 
1511
 *         else:
 
1512
 */
 
1513
    __pyx_t_7 = (PySequence_Contains(((PyObject *)__pyx_v_bmap), __pyx_v_idx)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1514
    if (__pyx_t_7) {
 
1515
 
 
1516
      /* "pandas/lib/src/tseries.pyx":121
 
1517
 *         idx = PyArray_GETITEM(A, <void *> itera.dataptr)
 
1518
 *         if idx in bmap:
 
1519
 *             result_data[i] = <double> bmap[idx]             # <<<<<<<<<<<<<<
 
1520
 *         else:
 
1521
 *             result_data[i] = nan
 
1522
 */
 
1523
      __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_bmap), __pyx_v_idx); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1524
      __Pyx_GOTREF(__pyx_1);
 
1525
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1526
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1527
      (__pyx_v_result_data[__pyx_v_i]) = ((double)__pyx_t_2);
 
1528
      goto __pyx_L8;
 
1529
    }
 
1530
    /*else*/ {
 
1531
 
 
1532
      /* "pandas/lib/src/tseries.pyx":123
 
1533
 *             result_data[i] = <double> bmap[idx]
 
1534
 *         else:
 
1535
 *             result_data[i] = nan             # <<<<<<<<<<<<<<
 
1536
 * 
 
1537
 *         PyArray_ITER_NEXT(itera)
 
1538
 */
 
1539
      (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_nan;
 
1540
    }
 
1541
    __pyx_L8:;
 
1542
 
 
1543
    /* "pandas/lib/src/tseries.pyx":125
 
1544
 *             result_data[i] = nan
 
1545
 * 
 
1546
 *         PyArray_ITER_NEXT(itera)             # <<<<<<<<<<<<<<
 
1547
 * 
 
1548
 *     return result.astype(int)
 
1549
 */
 
1550
    PyArray_ITER_NEXT(__pyx_v_itera);
 
1551
  }
 
1552
 
 
1553
  /* "pandas/lib/src/tseries.pyx":127
 
1554
 *         PyArray_ITER_NEXT(itera)
 
1555
 * 
 
1556
 *     return result.astype(int)             # <<<<<<<<<<<<<<
 
1557
 * 
 
1558
 * def reindex(ndarray index, ndarray arr, dict idxMap):
 
1559
 */
 
1560
  __Pyx_XDECREF(__pyx_r);
 
1561
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_kp_astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1562
  __Pyx_GOTREF(__pyx_t_4);
 
1563
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1564
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
1565
  __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
 
1566
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)((PyObject*)&PyInt_Type)));
 
1567
  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
 
1568
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1569
  __Pyx_GOTREF(__pyx_t_3);
 
1570
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1571
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
1572
  __pyx_r = __pyx_t_3;
 
1573
  __pyx_t_3 = 0;
 
1574
  goto __pyx_L0;
 
1575
 
 
1576
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
1577
  goto __pyx_L0;
 
1578
  __pyx_L1_error:;
 
1579
  __Pyx_XDECREF(__pyx_1);
 
1580
  __Pyx_XDECREF(__pyx_t_1);
 
1581
  __Pyx_XDECREF(__pyx_t_3);
 
1582
  __Pyx_XDECREF(__pyx_t_4);
 
1583
  __Pyx_XDECREF(__pyx_t_5);
 
1584
  __Pyx_AddTraceback("tseries.match");
 
1585
  __pyx_r = NULL;
 
1586
  __pyx_L0:;
 
1587
  __Pyx_DECREF((PyObject *)__pyx_v_itera);
 
1588
  __Pyx_DECREF(__pyx_v_bmap);
 
1589
  __Pyx_DECREF(__pyx_v_idx);
 
1590
  __Pyx_DECREF((PyObject *)__pyx_v_result);
 
1591
  __Pyx_XGIVEREF(__pyx_r);
 
1592
  __Pyx_FinishRefcountContext();
 
1593
  return __pyx_r;
 
1594
}
 
1595
 
 
1596
/* "pandas/lib/src/tseries.pyx":129
 
1597
 *     return result.astype(int)
 
1598
 * 
 
1599
 * def reindex(ndarray index, ndarray arr, dict idxMap):             # <<<<<<<<<<<<<<
 
1600
 *     '''
 
1601
 *     Using the provided new index, a given array, and a mapping of index-value
 
1602
 */
 
1603
 
 
1604
static PyObject *__pyx_pf_7tseries_reindex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
1605
static char __pyx_doc_7tseries_reindex[] = "\n    Using the provided new index, a given array, and a mapping of index-value\n    correpondences in the value array, return a new ndarray conforming to \n    the new index.\n    \n    This is significantly faster than doing it in pure Python.\n    ";
 
1606
static PyObject *__pyx_pf_7tseries_reindex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
1607
  PyArrayObject *__pyx_v_index = 0;
 
1608
  PyArrayObject *__pyx_v_arr = 0;
 
1609
  PyObject *__pyx_v_idxMap = 0;
 
1610
  PyArrayObject *__pyx_v_result;
 
1611
  double *__pyx_v_result_data;
 
1612
  int __pyx_v_i;
 
1613
  int __pyx_v_length;
 
1614
  PyArrayIterObject *__pyx_v_itera;
 
1615
  PyArrayIterObject *__pyx_v_iteridx;
 
1616
  double __pyx_v_nan;
 
1617
  PyObject *__pyx_v_idx;
 
1618
  PyObject *__pyx_r = NULL;
 
1619
  PyObject *__pyx_1 = 0;
 
1620
  PyObject *__pyx_t_1 = NULL;
 
1621
  double __pyx_t_2;
 
1622
  PyObject *__pyx_t_3 = NULL;
 
1623
  PyObject *__pyx_t_4 = NULL;
 
1624
  PyObject *__pyx_t_5 = NULL;
 
1625
  int __pyx_t_6;
 
1626
  int __pyx_t_7;
 
1627
  npy_intp __pyx_t_8;
 
1628
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_arr,&__pyx_kp_idxMap,0};
 
1629
  __Pyx_SetupRefcountContext("reindex");
 
1630
  __pyx_self = __pyx_self;
 
1631
  if (unlikely(__pyx_kwds)) {
 
1632
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
1633
    PyObject* values[3] = {0,0,0};
 
1634
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
1635
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
 
1636
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
1637
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
1638
      case  0: break;
 
1639
      default: goto __pyx_L5_argtuple_error;
 
1640
    }
 
1641
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
1642
      case  0:
 
1643
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
1644
      if (likely(values[0])) kw_args--;
 
1645
      else goto __pyx_L5_argtuple_error;
 
1646
      case  1:
 
1647
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_arr);
 
1648
      if (likely(values[1])) kw_args--;
 
1649
      else {
 
1650
        __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1651
      }
 
1652
      case  2:
 
1653
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_idxMap);
 
1654
      if (likely(values[2])) kw_args--;
 
1655
      else {
 
1656
        __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1657
      }
 
1658
    }
 
1659
    if (unlikely(kw_args > 0)) {
 
1660
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1661
    }
 
1662
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
1663
    __pyx_v_arr = ((PyArrayObject *)values[1]);
 
1664
    __pyx_v_idxMap = ((PyObject *)values[2]);
 
1665
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
 
1666
    goto __pyx_L5_argtuple_error;
 
1667
  } else {
 
1668
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
1669
    __pyx_v_arr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
1670
    __pyx_v_idxMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
 
1671
  }
 
1672
  goto __pyx_L4_argument_unpacking_done;
 
1673
  __pyx_L5_argtuple_error:;
 
1674
  __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1675
  __pyx_L3_error:;
 
1676
  __Pyx_AddTraceback("tseries.reindex");
 
1677
  return NULL;
 
1678
  __pyx_L4_argument_unpacking_done:;
 
1679
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
1680
  __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
1681
  __pyx_v_iteridx = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
1682
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
1683
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1684
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1685
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idxMap), &PyDict_Type, 1, "idxMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1686
 
 
1687
  /* "pandas/lib/src/tseries.pyx":144
 
1688
 *     cdef object idx
 
1689
 * 
 
1690
 *     nan = <double> np.NaN             # <<<<<<<<<<<<<<
 
1691
 * 
 
1692
 *     length = PyArray_SIZE(index)
 
1693
 */
 
1694
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1695
  __Pyx_GOTREF(__pyx_1);
 
1696
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1697
  __Pyx_GOTREF(__pyx_t_1);
 
1698
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1699
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1700
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
1701
  __pyx_v_nan = ((double)__pyx_t_2);
 
1702
 
 
1703
  /* "pandas/lib/src/tseries.pyx":146
 
1704
 *     nan = <double> np.NaN
 
1705
 * 
 
1706
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 
1707
 * 
 
1708
 *     result = <ndarray> np.empty(length, np.float64)
 
1709
 */
 
1710
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1711
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_index));
 
1712
 
 
1713
  /* "pandas/lib/src/tseries.pyx":148
 
1714
 *     length = PyArray_SIZE(index)
 
1715
 * 
 
1716
 *     result = <ndarray> np.empty(length, np.float64)             # <<<<<<<<<<<<<<
 
1717
 * 
 
1718
 *     result_data = <double *> result.data
 
1719
 */
 
1720
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1721
  __Pyx_GOTREF(__pyx_1);
 
1722
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1723
  __Pyx_GOTREF(__pyx_t_1);
 
1724
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1725
  __pyx_t_3 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1726
  __Pyx_GOTREF(__pyx_t_3);
 
1727
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1728
  __Pyx_GOTREF(__pyx_1);
 
1729
  __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1730
  __Pyx_GOTREF(__pyx_t_4);
 
1731
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1732
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1733
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
1734
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
 
1735
  __Pyx_GIVEREF(__pyx_t_3);
 
1736
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
 
1737
  __Pyx_GIVEREF(__pyx_t_4);
 
1738
  __pyx_t_3 = 0;
 
1739
  __pyx_t_4 = 0;
 
1740
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1741
  __Pyx_GOTREF(__pyx_t_4);
 
1742
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
1743
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
1744
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
1745
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
1746
  __pyx_v_result = ((PyArrayObject *)__pyx_t_4);
 
1747
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1748
 
 
1749
  /* "pandas/lib/src/tseries.pyx":150
 
1750
 *     result = <ndarray> np.empty(length, np.float64)
 
1751
 * 
 
1752
 *     result_data = <double *> result.data             # <<<<<<<<<<<<<<
 
1753
 * 
 
1754
 *     itera = PyArray_IterNew(arr)
 
1755
 */
 
1756
  __pyx_v_result_data = ((double *)__pyx_v_result->data);
 
1757
 
 
1758
  /* "pandas/lib/src/tseries.pyx":152
 
1759
 *     result_data = <double *> result.data
 
1760
 * 
 
1761
 *     itera = PyArray_IterNew(arr)             # <<<<<<<<<<<<<<
 
1762
 *     iteridx = PyArray_IterNew(index)
 
1763
 * 
 
1764
 */
 
1765
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_arr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1766
  __Pyx_GOTREF(__pyx_t_4);
 
1767
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1768
  __Pyx_DECREF(((PyObject *)__pyx_v_itera));
 
1769
  __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_4);
 
1770
  __pyx_t_4 = 0;
 
1771
 
 
1772
  /* "pandas/lib/src/tseries.pyx":153
 
1773
 * 
 
1774
 *     itera = PyArray_IterNew(arr)
 
1775
 *     iteridx = PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 
1776
 * 
 
1777
 *     for i from 0 <= i < length:
 
1778
 */
 
1779
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1780
  __Pyx_GOTREF(__pyx_t_4);
 
1781
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1782
  __Pyx_DECREF(((PyObject *)__pyx_v_iteridx));
 
1783
  __pyx_v_iteridx = ((PyArrayIterObject *)__pyx_t_4);
 
1784
  __pyx_t_4 = 0;
 
1785
 
 
1786
  /* "pandas/lib/src/tseries.pyx":155
 
1787
 *     iteridx = PyArray_IterNew(index)
 
1788
 * 
 
1789
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
1790
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
1791
 *         PyArray_ITER_NEXT(iteridx)
 
1792
 */
 
1793
  __pyx_t_6 = __pyx_v_length;
 
1794
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
 
1795
 
 
1796
    /* "pandas/lib/src/tseries.pyx":156
 
1797
 * 
 
1798
 *     for i from 0 <= i < length:
 
1799
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)             # <<<<<<<<<<<<<<
 
1800
 *         PyArray_ITER_NEXT(iteridx)
 
1801
 *         if idx not in idxMap:
 
1802
 */
 
1803
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_index), ((void *)__pyx_v_iteridx->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1804
    __Pyx_GOTREF(__pyx_t_4);
 
1805
    __Pyx_DECREF(__pyx_v_idx);
 
1806
    __pyx_v_idx = __pyx_t_4;
 
1807
    __pyx_t_4 = 0;
 
1808
 
 
1809
    /* "pandas/lib/src/tseries.pyx":157
 
1810
 *     for i from 0 <= i < length:
 
1811
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
1812
 *         PyArray_ITER_NEXT(iteridx)             # <<<<<<<<<<<<<<
 
1813
 *         if idx not in idxMap:
 
1814
 *             result_data[i] = nan
 
1815
 */
 
1816
    PyArray_ITER_NEXT(__pyx_v_iteridx);
 
1817
 
 
1818
    /* "pandas/lib/src/tseries.pyx":158
 
1819
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
1820
 *         PyArray_ITER_NEXT(iteridx)
 
1821
 *         if idx not in idxMap:             # <<<<<<<<<<<<<<
 
1822
 *             result_data[i] = nan
 
1823
 *             continue
 
1824
 */
 
1825
    __pyx_t_7 = (!PySequence_Contains(((PyObject *)__pyx_v_idxMap), __pyx_v_idx)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1826
    if (__pyx_t_7) {
 
1827
 
 
1828
      /* "pandas/lib/src/tseries.pyx":159
 
1829
 *         PyArray_ITER_NEXT(iteridx)
 
1830
 *         if idx not in idxMap:
 
1831
 *             result_data[i] = nan             # <<<<<<<<<<<<<<
 
1832
 *             continue
 
1833
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
1834
 */
 
1835
      (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_nan;
 
1836
 
 
1837
      /* "pandas/lib/src/tseries.pyx":160
 
1838
 *         if idx not in idxMap:
 
1839
 *             result_data[i] = nan
 
1840
 *             continue             # <<<<<<<<<<<<<<
 
1841
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
1842
 *         result_data[i] = (<double *>(itera.dataptr))[0]
 
1843
 */
 
1844
      goto __pyx_L6_continue;
 
1845
      goto __pyx_L8;
 
1846
    }
 
1847
    __pyx_L8:;
 
1848
 
 
1849
    /* "pandas/lib/src/tseries.pyx":161
 
1850
 *             result_data[i] = nan
 
1851
 *             continue
 
1852
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])             # <<<<<<<<<<<<<<
 
1853
 *         result_data[i] = (<double *>(itera.dataptr))[0]
 
1854
 * 
 
1855
 */
 
1856
    __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_idxMap), __pyx_v_idx); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1857
    __Pyx_GOTREF(__pyx_1);
 
1858
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1859
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
1860
    PyArray_ITER_GOTO1D(__pyx_v_itera, __pyx_t_8);
 
1861
 
 
1862
    /* "pandas/lib/src/tseries.pyx":162
 
1863
 *             continue
 
1864
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
1865
 *         result_data[i] = (<double *>(itera.dataptr))[0]             # <<<<<<<<<<<<<<
 
1866
 * 
 
1867
 *     return result
 
1868
 */
 
1869
    (__pyx_v_result_data[__pyx_v_i]) = (((double *)__pyx_v_itera->dataptr)[0]);
 
1870
    __pyx_L6_continue:;
 
1871
  }
 
1872
 
 
1873
  /* "pandas/lib/src/tseries.pyx":164
 
1874
 *         result_data[i] = (<double *>(itera.dataptr))[0]
 
1875
 * 
 
1876
 *     return result             # <<<<<<<<<<<<<<
 
1877
 * 
 
1878
 * def reindexObj(ndarray index, ndarray arr, dict idxMap):
 
1879
 */
 
1880
  __Pyx_XDECREF(__pyx_r);
 
1881
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
1882
  __pyx_r = ((PyObject *)__pyx_v_result);
 
1883
  goto __pyx_L0;
 
1884
 
 
1885
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
1886
  goto __pyx_L0;
 
1887
  __pyx_L1_error:;
 
1888
  __Pyx_XDECREF(__pyx_1);
 
1889
  __Pyx_XDECREF(__pyx_t_1);
 
1890
  __Pyx_XDECREF(__pyx_t_3);
 
1891
  __Pyx_XDECREF(__pyx_t_4);
 
1892
  __Pyx_XDECREF(__pyx_t_5);
 
1893
  __Pyx_AddTraceback("tseries.reindex");
 
1894
  __pyx_r = NULL;
 
1895
  __pyx_L0:;
 
1896
  __Pyx_DECREF((PyObject *)__pyx_v_result);
 
1897
  __Pyx_DECREF((PyObject *)__pyx_v_itera);
 
1898
  __Pyx_DECREF((PyObject *)__pyx_v_iteridx);
 
1899
  __Pyx_DECREF(__pyx_v_idx);
 
1900
  __Pyx_XGIVEREF(__pyx_r);
 
1901
  __Pyx_FinishRefcountContext();
 
1902
  return __pyx_r;
 
1903
}
 
1904
 
 
1905
/* "pandas/lib/src/tseries.pyx":166
 
1906
 *     return result
 
1907
 * 
 
1908
 * def reindexObj(ndarray index, ndarray arr, dict idxMap):             # <<<<<<<<<<<<<<
 
1909
 *     '''
 
1910
 *     Using the provided new index, a given array, and a mapping of index-value
 
1911
 */
 
1912
 
 
1913
static PyObject *__pyx_pf_7tseries_reindexObj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
1914
static char __pyx_doc_7tseries_reindexObj[] = "\n    Using the provided new index, a given array, and a mapping of index-value\n    correpondences in the value array, return a new ndarray conforming to \n    the new index.\n    \n    This is significantly faster than doing it in pure Python.\n    ";
 
1915
static PyObject *__pyx_pf_7tseries_reindexObj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
1916
  PyArrayObject *__pyx_v_index = 0;
 
1917
  PyArrayObject *__pyx_v_arr = 0;
 
1918
  PyObject *__pyx_v_idxMap = 0;
 
1919
  PyArrayObject *__pyx_v_result;
 
1920
  int __pyx_v_i;
 
1921
  int __pyx_v_length;
 
1922
  PyArrayIterObject *__pyx_v_itera;
 
1923
  PyArrayIterObject *__pyx_v_iteridx;
 
1924
  PyArrayIterObject *__pyx_v_iterresult;
 
1925
  PyObject *__pyx_v_idx;
 
1926
  PyObject *__pyx_v_nan;
 
1927
  PyObject *__pyx_v_obj;
 
1928
  int __pyx_v_res;
 
1929
  PyObject *__pyx_r = NULL;
 
1930
  PyObject *__pyx_1 = 0;
 
1931
  PyObject *__pyx_2 = 0;
 
1932
  PyObject *__pyx_t_1 = NULL;
 
1933
  PyObject *__pyx_t_2 = NULL;
 
1934
  PyObject *__pyx_t_3 = NULL;
 
1935
  int __pyx_t_4;
 
1936
  int __pyx_t_5;
 
1937
  npy_intp __pyx_t_6;
 
1938
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_arr,&__pyx_kp_idxMap,0};
 
1939
  __Pyx_SetupRefcountContext("reindexObj");
 
1940
  __pyx_self = __pyx_self;
 
1941
  if (unlikely(__pyx_kwds)) {
 
1942
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
1943
    PyObject* values[3] = {0,0,0};
 
1944
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
1945
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
 
1946
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
1947
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
1948
      case  0: break;
 
1949
      default: goto __pyx_L5_argtuple_error;
 
1950
    }
 
1951
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
1952
      case  0:
 
1953
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
1954
      if (likely(values[0])) kw_args--;
 
1955
      else goto __pyx_L5_argtuple_error;
 
1956
      case  1:
 
1957
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_arr);
 
1958
      if (likely(values[1])) kw_args--;
 
1959
      else {
 
1960
        __Pyx_RaiseArgtupleInvalid("reindexObj", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1961
      }
 
1962
      case  2:
 
1963
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_idxMap);
 
1964
      if (likely(values[2])) kw_args--;
 
1965
      else {
 
1966
        __Pyx_RaiseArgtupleInvalid("reindexObj", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1967
      }
 
1968
    }
 
1969
    if (unlikely(kw_args > 0)) {
 
1970
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindexObj") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1971
    }
 
1972
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
1973
    __pyx_v_arr = ((PyArrayObject *)values[1]);
 
1974
    __pyx_v_idxMap = ((PyObject *)values[2]);
 
1975
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
 
1976
    goto __pyx_L5_argtuple_error;
 
1977
  } else {
 
1978
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
1979
    __pyx_v_arr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
1980
    __pyx_v_idxMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
 
1981
  }
 
1982
  goto __pyx_L4_argument_unpacking_done;
 
1983
  __pyx_L5_argtuple_error:;
 
1984
  __Pyx_RaiseArgtupleInvalid("reindexObj", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
1985
  __pyx_L3_error:;
 
1986
  __Pyx_AddTraceback("tseries.reindexObj");
 
1987
  return NULL;
 
1988
  __pyx_L4_argument_unpacking_done:;
 
1989
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
1990
  __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
1991
  __pyx_v_iteridx = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
1992
  __pyx_v_iterresult = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
1993
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
1994
  __pyx_v_nan = Py_None; __Pyx_INCREF(Py_None);
 
1995
  __pyx_v_obj = Py_None; __Pyx_INCREF(Py_None);
 
1996
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1997
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1998
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idxMap), &PyDict_Type, 1, "idxMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1999
 
 
2000
  /* "pandas/lib/src/tseries.pyx":179
 
2001
 *     cdef object idx, nan, obj
 
2002
 * 
 
2003
 *     nan = np.NaN             # <<<<<<<<<<<<<<
 
2004
 *     length = PyArray_SIZE(index)
 
2005
 * 
 
2006
 */
 
2007
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2008
  __Pyx_GOTREF(__pyx_1);
 
2009
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2010
  __Pyx_GOTREF(__pyx_t_1);
 
2011
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
2012
  __Pyx_DECREF(__pyx_v_nan);
 
2013
  __pyx_v_nan = __pyx_t_1;
 
2014
  __pyx_t_1 = 0;
 
2015
 
 
2016
  /* "pandas/lib/src/tseries.pyx":180
 
2017
 * 
 
2018
 *     nan = np.NaN
 
2019
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 
2020
 * 
 
2021
 *     result = <ndarray> np.empty(length, dtype=np.object_)
 
2022
 */
 
2023
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2024
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_index));
 
2025
 
 
2026
  /* "pandas/lib/src/tseries.pyx":182
 
2027
 *     length = PyArray_SIZE(index)
 
2028
 * 
 
2029
 *     result = <ndarray> np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 
2030
 * 
 
2031
 *     itera = PyArray_IterNew(arr)
 
2032
 */
 
2033
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2034
  __Pyx_GOTREF(__pyx_1);
 
2035
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2036
  __Pyx_GOTREF(__pyx_t_1);
 
2037
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
2038
  __pyx_t_2 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2039
  __Pyx_GOTREF(__pyx_t_2);
 
2040
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2041
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
2042
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
 
2043
  __Pyx_GIVEREF(__pyx_t_2);
 
2044
  __pyx_t_2 = 0;
 
2045
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2046
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
2047
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2048
  __Pyx_GOTREF(__pyx_2);
 
2049
  __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_object_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2050
  __Pyx_GOTREF(__pyx_t_2);
 
2051
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
2052
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2053
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
2054
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2055
  __Pyx_GOTREF(__pyx_t_2);
 
2056
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2057
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
2058
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
2059
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
 
2060
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
2061
  __pyx_v_result = ((PyArrayObject *)__pyx_t_2);
 
2062
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
2063
 
 
2064
  /* "pandas/lib/src/tseries.pyx":184
 
2065
 *     result = <ndarray> np.empty(length, dtype=np.object_)
 
2066
 * 
 
2067
 *     itera = PyArray_IterNew(arr)             # <<<<<<<<<<<<<<
 
2068
 *     iteridx = PyArray_IterNew(index)
 
2069
 *     iterresult = PyArray_IterNew(result)
 
2070
 */
 
2071
  __pyx_t_2 = PyArray_IterNew(((PyObject *)__pyx_v_arr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2072
  __Pyx_GOTREF(__pyx_t_2);
 
2073
  if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2074
  __Pyx_DECREF(((PyObject *)__pyx_v_itera));
 
2075
  __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_2);
 
2076
  __pyx_t_2 = 0;
 
2077
 
 
2078
  /* "pandas/lib/src/tseries.pyx":185
 
2079
 * 
 
2080
 *     itera = PyArray_IterNew(arr)
 
2081
 *     iteridx = PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 
2082
 *     iterresult = PyArray_IterNew(result)
 
2083
 * 
 
2084
 */
 
2085
  __pyx_t_2 = PyArray_IterNew(((PyObject *)__pyx_v_index)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2086
  __Pyx_GOTREF(__pyx_t_2);
 
2087
  if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2088
  __Pyx_DECREF(((PyObject *)__pyx_v_iteridx));
 
2089
  __pyx_v_iteridx = ((PyArrayIterObject *)__pyx_t_2);
 
2090
  __pyx_t_2 = 0;
 
2091
 
 
2092
  /* "pandas/lib/src/tseries.pyx":186
 
2093
 *     itera = PyArray_IterNew(arr)
 
2094
 *     iteridx = PyArray_IterNew(index)
 
2095
 *     iterresult = PyArray_IterNew(result)             # <<<<<<<<<<<<<<
 
2096
 * 
 
2097
 *     cdef int res
 
2098
 */
 
2099
  __pyx_t_2 = PyArray_IterNew(((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2100
  __Pyx_GOTREF(__pyx_t_2);
 
2101
  if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2102
  __Pyx_DECREF(((PyObject *)__pyx_v_iterresult));
 
2103
  __pyx_v_iterresult = ((PyArrayIterObject *)__pyx_t_2);
 
2104
  __pyx_t_2 = 0;
 
2105
 
 
2106
  /* "pandas/lib/src/tseries.pyx":190
 
2107
 *     cdef int res
 
2108
 * 
 
2109
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
2110
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
2111
 *         PyArray_ITER_NEXT(iteridx)
 
2112
 */
 
2113
  __pyx_t_4 = __pyx_v_length;
 
2114
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
 
2115
 
 
2116
    /* "pandas/lib/src/tseries.pyx":191
 
2117
 * 
 
2118
 *     for i from 0 <= i < length:
 
2119
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)             # <<<<<<<<<<<<<<
 
2120
 *         PyArray_ITER_NEXT(iteridx)
 
2121
 * 
 
2122
 */
 
2123
    __pyx_t_2 = PyArray_GETITEM(((PyObject *)__pyx_v_index), ((void *)__pyx_v_iteridx->dataptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2124
    __Pyx_GOTREF(__pyx_t_2);
 
2125
    __Pyx_DECREF(__pyx_v_idx);
 
2126
    __pyx_v_idx = __pyx_t_2;
 
2127
    __pyx_t_2 = 0;
 
2128
 
 
2129
    /* "pandas/lib/src/tseries.pyx":192
 
2130
 *     for i from 0 <= i < length:
 
2131
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
2132
 *         PyArray_ITER_NEXT(iteridx)             # <<<<<<<<<<<<<<
 
2133
 * 
 
2134
 *         if idx not in idxMap:
 
2135
 */
 
2136
    PyArray_ITER_NEXT(__pyx_v_iteridx);
 
2137
 
 
2138
    /* "pandas/lib/src/tseries.pyx":194
 
2139
 *         PyArray_ITER_NEXT(iteridx)
 
2140
 * 
 
2141
 *         if idx not in idxMap:             # <<<<<<<<<<<<<<
 
2142
 *             PyArray_SETITEM(result, <void *> iterresult.dataptr, nan)
 
2143
 *             PyArray_ITER_NEXT(iterresult)
 
2144
 */
 
2145
    __pyx_t_5 = (!PySequence_Contains(((PyObject *)__pyx_v_idxMap), __pyx_v_idx)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2146
    if (__pyx_t_5) {
 
2147
 
 
2148
      /* "pandas/lib/src/tseries.pyx":195
 
2149
 * 
 
2150
 *         if idx not in idxMap:
 
2151
 *             PyArray_SETITEM(result, <void *> iterresult.dataptr, nan)             # <<<<<<<<<<<<<<
 
2152
 *             PyArray_ITER_NEXT(iterresult)
 
2153
 *             continue
 
2154
 */
 
2155
      PyArray_SETITEM(((PyObject *)__pyx_v_result), ((void *)__pyx_v_iterresult->dataptr), __pyx_v_nan);
 
2156
 
 
2157
      /* "pandas/lib/src/tseries.pyx":196
 
2158
 *         if idx not in idxMap:
 
2159
 *             PyArray_SETITEM(result, <void *> iterresult.dataptr, nan)
 
2160
 *             PyArray_ITER_NEXT(iterresult)             # <<<<<<<<<<<<<<
 
2161
 *             continue
 
2162
 * 
 
2163
 */
 
2164
      PyArray_ITER_NEXT(__pyx_v_iterresult);
 
2165
 
 
2166
      /* "pandas/lib/src/tseries.pyx":197
 
2167
 *             PyArray_SETITEM(result, <void *> iterresult.dataptr, nan)
 
2168
 *             PyArray_ITER_NEXT(iterresult)
 
2169
 *             continue             # <<<<<<<<<<<<<<
 
2170
 * 
 
2171
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
2172
 */
 
2173
      goto __pyx_L6_continue;
 
2174
      goto __pyx_L8;
 
2175
    }
 
2176
    __pyx_L8:;
 
2177
 
 
2178
    /* "pandas/lib/src/tseries.pyx":199
 
2179
 *             continue
 
2180
 * 
 
2181
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])             # <<<<<<<<<<<<<<
 
2182
 *         obj = PyArray_GETITEM(arr, <void *> itera.dataptr)
 
2183
 * 
 
2184
 */
 
2185
    __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_idxMap), __pyx_v_idx); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2186
    __Pyx_GOTREF(__pyx_2);
 
2187
    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2188
    __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
2189
    PyArray_ITER_GOTO1D(__pyx_v_itera, __pyx_t_6);
 
2190
 
 
2191
    /* "pandas/lib/src/tseries.pyx":200
 
2192
 * 
 
2193
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
2194
 *         obj = PyArray_GETITEM(arr, <void *> itera.dataptr)             # <<<<<<<<<<<<<<
 
2195
 * 
 
2196
 *         res = PyArray_SETITEM(result, <void *> iterresult.dataptr, obj)
 
2197
 */
 
2198
    __pyx_t_2 = PyArray_GETITEM(((PyObject *)__pyx_v_arr), ((void *)__pyx_v_itera->dataptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2199
    __Pyx_GOTREF(__pyx_t_2);
 
2200
    __Pyx_DECREF(__pyx_v_obj);
 
2201
    __pyx_v_obj = __pyx_t_2;
 
2202
    __pyx_t_2 = 0;
 
2203
 
 
2204
    /* "pandas/lib/src/tseries.pyx":202
 
2205
 *         obj = PyArray_GETITEM(arr, <void *> itera.dataptr)
 
2206
 * 
 
2207
 *         res = PyArray_SETITEM(result, <void *> iterresult.dataptr, obj)             # <<<<<<<<<<<<<<
 
2208
 *         PyArray_ITER_NEXT(iterresult)
 
2209
 * 
 
2210
 */
 
2211
    __pyx_v_res = PyArray_SETITEM(((PyObject *)__pyx_v_result), ((void *)__pyx_v_iterresult->dataptr), __pyx_v_obj);
 
2212
 
 
2213
    /* "pandas/lib/src/tseries.pyx":203
 
2214
 * 
 
2215
 *         res = PyArray_SETITEM(result, <void *> iterresult.dataptr, obj)
 
2216
 *         PyArray_ITER_NEXT(iterresult)             # <<<<<<<<<<<<<<
 
2217
 * 
 
2218
 *     return result
 
2219
 */
 
2220
    PyArray_ITER_NEXT(__pyx_v_iterresult);
 
2221
    __pyx_L6_continue:;
 
2222
  }
 
2223
 
 
2224
  /* "pandas/lib/src/tseries.pyx":205
 
2225
 *         PyArray_ITER_NEXT(iterresult)
 
2226
 * 
 
2227
 *     return result             # <<<<<<<<<<<<<<
 
2228
 * 
 
2229
 * @cython.boundscheck(False)
 
2230
 */
 
2231
  __Pyx_XDECREF(__pyx_r);
 
2232
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
2233
  __pyx_r = ((PyObject *)__pyx_v_result);
 
2234
  goto __pyx_L0;
 
2235
 
 
2236
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2237
  goto __pyx_L0;
 
2238
  __pyx_L1_error:;
 
2239
  __Pyx_XDECREF(__pyx_1);
 
2240
  __Pyx_XDECREF(__pyx_2);
 
2241
  __Pyx_XDECREF(__pyx_t_1);
 
2242
  __Pyx_XDECREF(__pyx_t_2);
 
2243
  __Pyx_XDECREF(__pyx_t_3);
 
2244
  __Pyx_AddTraceback("tseries.reindexObj");
 
2245
  __pyx_r = NULL;
 
2246
  __pyx_L0:;
 
2247
  __Pyx_DECREF((PyObject *)__pyx_v_result);
 
2248
  __Pyx_DECREF((PyObject *)__pyx_v_itera);
 
2249
  __Pyx_DECREF((PyObject *)__pyx_v_iteridx);
 
2250
  __Pyx_DECREF((PyObject *)__pyx_v_iterresult);
 
2251
  __Pyx_DECREF(__pyx_v_idx);
 
2252
  __Pyx_DECREF(__pyx_v_nan);
 
2253
  __Pyx_DECREF(__pyx_v_obj);
 
2254
  __Pyx_XGIVEREF(__pyx_r);
 
2255
  __Pyx_FinishRefcountContext();
 
2256
  return __pyx_r;
 
2257
}
 
2258
 
 
2259
/* "pandas/lib/src/tseries.pyx":208
 
2260
 * 
 
2261
 * @cython.boundscheck(False)
 
2262
 * def reindexObject(ndarray[object, ndim=1] index,             # <<<<<<<<<<<<<<
 
2263
 *                   ndarray[object, ndim=1] arr,
 
2264
 *                   dict idxMap):
 
2265
 */
 
2266
 
 
2267
static PyObject *__pyx_pf_7tseries_reindexObject(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
2268
static char __pyx_doc_7tseries_reindexObject[] = "\n    Using the provided new index, a given array, and a mapping of index-value\n    correpondences in the value array, return a new ndarray conforming to \n    the new index.\n    ";
 
2269
static PyObject *__pyx_pf_7tseries_reindexObject(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
2270
  PyArrayObject *__pyx_v_index = 0;
 
2271
  PyArrayObject *__pyx_v_arr = 0;
 
2272
  PyObject *__pyx_v_idxMap = 0;
 
2273
  int __pyx_v_loc;
 
2274
  int __pyx_v_length;
 
2275
  PyObject *__pyx_v_idx;
 
2276
  PyObject *__pyx_v_value;
 
2277
  PyObject *__pyx_v_nan = 0;
 
2278
  PyArrayObject *__pyx_v_result = 0;
 
2279
  int __pyx_v_i;
 
2280
  Py_buffer __pyx_bstruct_index;
 
2281
  Py_ssize_t __pyx_bstride_0_index = 0;
 
2282
  Py_ssize_t __pyx_bshape_0_index = 0;
 
2283
  Py_buffer __pyx_bstruct_arr;
 
2284
  Py_ssize_t __pyx_bstride_0_arr = 0;
 
2285
  Py_ssize_t __pyx_bshape_0_arr = 0;
 
2286
  Py_buffer __pyx_bstruct_result;
 
2287
  Py_ssize_t __pyx_bstride_0_result = 0;
 
2288
  Py_ssize_t __pyx_bshape_0_result = 0;
 
2289
  PyObject *__pyx_r = NULL;
 
2290
  PyObject *__pyx_1 = 0;
 
2291
  PyObject *__pyx_2 = 0;
 
2292
  PyObject *__pyx_t_1 = NULL;
 
2293
  PyObject *__pyx_t_2 = NULL;
 
2294
  PyObject *__pyx_t_3 = NULL;
 
2295
  PyArrayObject *__pyx_t_4 = NULL;
 
2296
  int __pyx_t_5;
 
2297
  int __pyx_t_6;
 
2298
  int __pyx_t_7;
 
2299
  int __pyx_t_8;
 
2300
  PyObject **__pyx_t_9;
 
2301
  int __pyx_t_10;
 
2302
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_arr,&__pyx_kp_idxMap,0};
 
2303
  __Pyx_SetupRefcountContext("reindexObject");
 
2304
  __pyx_self = __pyx_self;
 
2305
  if (unlikely(__pyx_kwds)) {
 
2306
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
2307
    PyObject* values[3] = {0,0,0};
 
2308
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
2309
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
 
2310
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
2311
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
2312
      case  0: break;
 
2313
      default: goto __pyx_L5_argtuple_error;
 
2314
    }
 
2315
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
2316
      case  0:
 
2317
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
2318
      if (likely(values[0])) kw_args--;
 
2319
      else goto __pyx_L5_argtuple_error;
 
2320
      case  1:
 
2321
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_arr);
 
2322
      if (likely(values[1])) kw_args--;
 
2323
      else {
 
2324
        __Pyx_RaiseArgtupleInvalid("reindexObject", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2325
      }
 
2326
      case  2:
 
2327
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_idxMap);
 
2328
      if (likely(values[2])) kw_args--;
 
2329
      else {
 
2330
        __Pyx_RaiseArgtupleInvalid("reindexObject", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2331
      }
 
2332
    }
 
2333
    if (unlikely(kw_args > 0)) {
 
2334
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindexObject") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2335
    }
 
2336
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
2337
    __pyx_v_arr = ((PyArrayObject *)values[1]);
 
2338
    __pyx_v_idxMap = ((PyObject *)values[2]);
 
2339
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
 
2340
    goto __pyx_L5_argtuple_error;
 
2341
  } else {
 
2342
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
2343
    __pyx_v_arr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
2344
    __pyx_v_idxMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
 
2345
  }
 
2346
  goto __pyx_L4_argument_unpacking_done;
 
2347
  __pyx_L5_argtuple_error:;
 
2348
  __Pyx_RaiseArgtupleInvalid("reindexObject", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2349
  __pyx_L3_error:;
 
2350
  __Pyx_AddTraceback("tseries.reindexObject");
 
2351
  return NULL;
 
2352
  __pyx_L4_argument_unpacking_done:;
 
2353
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
2354
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
 
2355
  __pyx_bstruct_result.buf = NULL;
 
2356
  __pyx_bstruct_index.buf = NULL;
 
2357
  __pyx_bstruct_arr.buf = NULL;
 
2358
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2359
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2360
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idxMap), &PyDict_Type, 1, "idxMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2361
  {
 
2362
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
2363
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2364
  }
 
2365
  __pyx_bstride_0_index = __pyx_bstruct_index.strides[0];
 
2366
  __pyx_bshape_0_index = __pyx_bstruct_index.shape[0];
 
2367
  {
 
2368
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
2369
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_arr, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2370
  }
 
2371
  __pyx_bstride_0_arr = __pyx_bstruct_arr.strides[0];
 
2372
  __pyx_bshape_0_arr = __pyx_bstruct_arr.shape[0];
 
2373
 
 
2374
  /* "pandas/lib/src/tseries.pyx":218
 
2375
 *     cdef int j, loc, length
 
2376
 *     cdef object idx, value
 
2377
 *     cdef object nan = np.NaN             # <<<<<<<<<<<<<<
 
2378
 * 
 
2379
 *     length = index.shape[0]
 
2380
 */
 
2381
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2382
  __Pyx_GOTREF(__pyx_1);
 
2383
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2384
  __Pyx_GOTREF(__pyx_t_1);
 
2385
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
2386
  __pyx_v_nan = __pyx_t_1;
 
2387
  __pyx_t_1 = 0;
 
2388
 
 
2389
  /* "pandas/lib/src/tseries.pyx":220
 
2390
 *     cdef object nan = np.NaN
 
2391
 * 
 
2392
 *     length = index.shape[0]             # <<<<<<<<<<<<<<
 
2393
 *     cdef ndarray[object, ndim = 1] result = np.empty(length, dtype=object)
 
2394
 * 
 
2395
 */
 
2396
  __pyx_v_length = (__pyx_v_index->dimensions[0]);
 
2397
 
 
2398
  /* "pandas/lib/src/tseries.pyx":221
 
2399
 * 
 
2400
 *     length = index.shape[0]
 
2401
 *     cdef ndarray[object, ndim = 1] result = np.empty(length, dtype=object)             # <<<<<<<<<<<<<<
 
2402
 * 
 
2403
 *     loc = 0
 
2404
 */
 
2405
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2406
  __Pyx_GOTREF(__pyx_1);
 
2407
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2408
  __Pyx_GOTREF(__pyx_t_1);
 
2409
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
2410
  __pyx_t_2 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2411
  __Pyx_GOTREF(__pyx_t_2);
 
2412
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2413
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
2414
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
 
2415
  __Pyx_GIVEREF(__pyx_t_2);
 
2416
  __pyx_t_2 = 0;
 
2417
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2418
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
2419
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2420
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2421
  __Pyx_GOTREF(__pyx_t_2);
 
2422
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2423
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
2424
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
2425
  if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2426
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
 
2427
  {
 
2428
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
2429
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
 
2430
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_result.buf = NULL;
 
2431
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2432
    } else {__pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
 
2433
      __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
 
2434
    }
 
2435
  }
 
2436
  __pyx_t_4 = 0;
 
2437
  __pyx_v_result = ((PyArrayObject *)__pyx_t_2);
 
2438
  __pyx_t_2 = 0;
 
2439
 
 
2440
  /* "pandas/lib/src/tseries.pyx":223
 
2441
 *     cdef ndarray[object, ndim = 1] result = np.empty(length, dtype=object)
 
2442
 * 
 
2443
 *     loc = 0             # <<<<<<<<<<<<<<
 
2444
 *     cdef int i = 0
 
2445
 *     for i from 0 <= i < length:
 
2446
 */
 
2447
  __pyx_v_loc = 0;
 
2448
 
 
2449
  /* "pandas/lib/src/tseries.pyx":224
 
2450
 * 
 
2451
 *     loc = 0
 
2452
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 
2453
 *     for i from 0 <= i < length:
 
2454
 *         idx = index[i]
 
2455
 */
 
2456
  __pyx_v_i = 0;
 
2457
 
 
2458
  /* "pandas/lib/src/tseries.pyx":225
 
2459
 *     loc = 0
 
2460
 *     cdef int i = 0
 
2461
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
2462
 *         idx = index[i]
 
2463
 *         if not PyDict_Contains(idxMap, idx):
 
2464
 */
 
2465
  __pyx_t_5 = __pyx_v_length;
 
2466
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
2467
 
 
2468
    /* "pandas/lib/src/tseries.pyx":226
 
2469
 *     cdef int i = 0
 
2470
 *     for i from 0 <= i < length:
 
2471
 *         idx = index[i]             # <<<<<<<<<<<<<<
 
2472
 *         if not PyDict_Contains(idxMap, idx):
 
2473
 *             result[i] = nan
 
2474
 */
 
2475
    __pyx_t_6 = __pyx_v_i;
 
2476
    if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_index;
 
2477
    __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_6, __pyx_bstride_0_index);
 
2478
    __Pyx_INCREF((PyObject*)__pyx_1);
 
2479
    __Pyx_DECREF(__pyx_v_idx);
 
2480
    __pyx_v_idx = __pyx_1;
 
2481
    __pyx_1 = 0;
 
2482
 
 
2483
    /* "pandas/lib/src/tseries.pyx":227
 
2484
 *     for i from 0 <= i < length:
 
2485
 *         idx = index[i]
 
2486
 *         if not PyDict_Contains(idxMap, idx):             # <<<<<<<<<<<<<<
 
2487
 *             result[i] = nan
 
2488
 *             continue
 
2489
 */
 
2490
    __pyx_t_7 = (!PyDict_Contains(((PyObject *)__pyx_v_idxMap), __pyx_v_idx));
 
2491
    if (__pyx_t_7) {
 
2492
 
 
2493
      /* "pandas/lib/src/tseries.pyx":228
 
2494
 *         idx = index[i]
 
2495
 *         if not PyDict_Contains(idxMap, idx):
 
2496
 *             result[i] = nan             # <<<<<<<<<<<<<<
 
2497
 *             continue
 
2498
 *         value = arr[idxMap[idx]]
 
2499
 */
 
2500
      __pyx_t_8 = __pyx_v_i;
 
2501
      if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_result;
 
2502
      __pyx_t_9 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_8, __pyx_bstride_0_result);
 
2503
      __Pyx_GOTREF(*__pyx_t_9);
 
2504
      __Pyx_DECREF(*__pyx_t_9); __Pyx_INCREF(__pyx_v_nan);
 
2505
      *__pyx_t_9 = __pyx_v_nan;
 
2506
      __Pyx_GIVEREF(*__pyx_t_9);
 
2507
 
 
2508
      /* "pandas/lib/src/tseries.pyx":229
 
2509
 *         if not PyDict_Contains(idxMap, idx):
 
2510
 *             result[i] = nan
 
2511
 *             continue             # <<<<<<<<<<<<<<
 
2512
 *         value = arr[idxMap[idx]]
 
2513
 *         result[i] = value
 
2514
 */
 
2515
      goto __pyx_L6_continue;
 
2516
      goto __pyx_L8;
 
2517
    }
 
2518
    __pyx_L8:;
 
2519
 
 
2520
    /* "pandas/lib/src/tseries.pyx":230
 
2521
 *             result[i] = nan
 
2522
 *             continue
 
2523
 *         value = arr[idxMap[idx]]             # <<<<<<<<<<<<<<
 
2524
 *         result[i] = value
 
2525
 *     return result
 
2526
 */
 
2527
    __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_idxMap), __pyx_v_idx); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2528
    __Pyx_GOTREF(__pyx_1);
 
2529
    __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_arr), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2530
    __Pyx_GOTREF(__pyx_2);
 
2531
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
2532
    __Pyx_DECREF(__pyx_v_value);
 
2533
    __pyx_v_value = __pyx_2;
 
2534
    __pyx_2 = 0;
 
2535
 
 
2536
    /* "pandas/lib/src/tseries.pyx":231
 
2537
 *             continue
 
2538
 *         value = arr[idxMap[idx]]
 
2539
 *         result[i] = value             # <<<<<<<<<<<<<<
 
2540
 *     return result
 
2541
 * 
 
2542
 */
 
2543
    __pyx_t_10 = __pyx_v_i;
 
2544
    if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_result;
 
2545
    __pyx_t_9 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_10, __pyx_bstride_0_result);
 
2546
    __Pyx_GOTREF(*__pyx_t_9);
 
2547
    __Pyx_DECREF(*__pyx_t_9); __Pyx_INCREF(__pyx_v_value);
 
2548
    *__pyx_t_9 = __pyx_v_value;
 
2549
    __Pyx_GIVEREF(*__pyx_t_9);
 
2550
    __pyx_L6_continue:;
 
2551
  }
 
2552
 
 
2553
  /* "pandas/lib/src/tseries.pyx":232
 
2554
 *         value = arr[idxMap[idx]]
 
2555
 *         result[i] = value
 
2556
 *     return result             # <<<<<<<<<<<<<<
 
2557
 * 
 
2558
 * cdef tuple _nofill(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):
 
2559
 */
 
2560
  __Pyx_XDECREF(__pyx_r);
 
2561
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
2562
  __pyx_r = ((PyObject *)__pyx_v_result);
 
2563
  goto __pyx_L0;
 
2564
 
 
2565
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2566
  goto __pyx_L0;
 
2567
  __pyx_L1_error:;
 
2568
  __Pyx_XDECREF(__pyx_1);
 
2569
  __Pyx_XDECREF(__pyx_2);
 
2570
  __Pyx_XDECREF(__pyx_t_1);
 
2571
  __Pyx_XDECREF(__pyx_t_2);
 
2572
  __Pyx_XDECREF(__pyx_t_3);
 
2573
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
2574
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
2575
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
2576
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
 
2577
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
2578
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
2579
  __Pyx_AddTraceback("tseries.reindexObject");
 
2580
  __pyx_r = NULL;
 
2581
  goto __pyx_L2;
 
2582
  __pyx_L0:;
 
2583
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
2584
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
 
2585
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
2586
  __pyx_L2:;
 
2587
  __Pyx_DECREF(__pyx_v_idx);
 
2588
  __Pyx_DECREF(__pyx_v_value);
 
2589
  __Pyx_XDECREF(__pyx_v_nan);
 
2590
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
 
2591
  __Pyx_XGIVEREF(__pyx_r);
 
2592
  __Pyx_FinishRefcountContext();
 
2593
  return __pyx_r;
 
2594
}
 
2595
 
 
2596
/* "pandas/lib/src/tseries.pyx":234
 
2597
 *     return result
 
2598
 * 
 
2599
 * cdef tuple _nofill(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):             # <<<<<<<<<<<<<<
 
2600
 *     cdef int *fillLocs
 
2601
 *     cdef char *mask
 
2602
 */
 
2603
 
 
2604
static  PyObject *__pyx_f_7tseries__nofill(PyArrayObject *__pyx_v_oldIndex, PyArrayObject *__pyx_v_newIndex, PyObject *__pyx_v_oldMap, PyObject *__pyx_v_newMap) {
 
2605
  int *__pyx_v_fillLocs;
 
2606
  char *__pyx_v_mask;
 
2607
  int __pyx_v_i;
 
2608
  int __pyx_v_j;
 
2609
  int __pyx_v_length;
 
2610
  int __pyx_v_newLength;
 
2611
  PyArrayIterObject *__pyx_v_iterold;
 
2612
  PyObject *__pyx_v_idx;
 
2613
  PyArrayObject *__pyx_v_fillVec;
 
2614
  PyArrayObject *__pyx_v_maskVec;
 
2615
  PyObject *__pyx_r = NULL;
 
2616
  PyObject *__pyx_1 = 0;
 
2617
  PyObject *__pyx_2 = 0;
 
2618
  PyObject *__pyx_t_1 = NULL;
 
2619
  Py_ssize_t __pyx_t_2;
 
2620
  PyObject *__pyx_t_3 = NULL;
 
2621
  PyObject *__pyx_t_4 = NULL;
 
2622
  int __pyx_t_5;
 
2623
  int __pyx_t_6;
 
2624
  int __pyx_t_7;
 
2625
  __Pyx_SetupRefcountContext("_nofill");
 
2626
  __pyx_v_iterold = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
2627
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
2628
  __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
2629
  __pyx_v_maskVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
2630
 
 
2631
  /* "pandas/lib/src/tseries.pyx":244
 
2632
 *     cdef ndarray maskVec
 
2633
 * 
 
2634
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)             # <<<<<<<<<<<<<<
 
2635
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)
 
2636
 * 
 
2637
 */
 
2638
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2639
  __Pyx_GOTREF(__pyx_1);
 
2640
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2641
  __Pyx_GOTREF(__pyx_t_1);
 
2642
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
2643
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2644
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2645
  __Pyx_GOTREF(__pyx_t_3);
 
2646
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2647
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
2648
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
 
2649
  __Pyx_GIVEREF(__pyx_t_3);
 
2650
  __pyx_t_3 = 0;
 
2651
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2652
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
2653
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2654
  __Pyx_GOTREF(__pyx_2);
 
2655
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_33); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2656
  __Pyx_GOTREF(__pyx_t_3);
 
2657
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
2658
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2659
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
2660
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2661
  __Pyx_GOTREF(__pyx_t_3);
 
2662
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2663
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
2664
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
2665
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
 
2666
  __Pyx_DECREF(((PyObject *)__pyx_v_fillVec));
 
2667
  __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_3);
 
2668
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
2669
 
 
2670
  /* "pandas/lib/src/tseries.pyx":245
 
2671
 * 
 
2672
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)
 
2673
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)             # <<<<<<<<<<<<<<
 
2674
 * 
 
2675
 *     fillLocs = <int *> fillVec.data
 
2676
 */
 
2677
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2678
  __Pyx_GOTREF(__pyx_2);
 
2679
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2680
  __Pyx_GOTREF(__pyx_t_3);
 
2681
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
2682
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2683
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2684
  __Pyx_GOTREF(__pyx_t_4);
 
2685
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2686
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
2687
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
 
2688
  __Pyx_GIVEREF(__pyx_t_4);
 
2689
  __pyx_t_4 = 0;
 
2690
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2691
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
2692
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2693
  __Pyx_GOTREF(__pyx_2);
 
2694
  __pyx_t_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_34); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2695
  __Pyx_GOTREF(__pyx_t_4);
 
2696
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
2697
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2698
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
2699
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2700
  __Pyx_GOTREF(__pyx_t_4);
 
2701
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
2702
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
2703
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
2704
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
2705
  __Pyx_DECREF(((PyObject *)__pyx_v_maskVec));
 
2706
  __pyx_v_maskVec = ((PyArrayObject *)__pyx_t_4);
 
2707
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
2708
 
 
2709
  /* "pandas/lib/src/tseries.pyx":247
 
2710
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)
 
2711
 * 
 
2712
 *     fillLocs = <int *> fillVec.data             # <<<<<<<<<<<<<<
 
2713
 *     mask = <char *> maskVec.data
 
2714
 * 
 
2715
 */
 
2716
  __pyx_v_fillLocs = ((int *)__pyx_v_fillVec->data);
 
2717
 
 
2718
  /* "pandas/lib/src/tseries.pyx":248
 
2719
 * 
 
2720
 *     fillLocs = <int *> fillVec.data
 
2721
 *     mask = <char *> maskVec.data             # <<<<<<<<<<<<<<
 
2722
 * 
 
2723
 *     newLength = PyArray_SIZE(fillVec)
 
2724
 */
 
2725
  __pyx_v_mask = ((char *)__pyx_v_maskVec->data);
 
2726
 
 
2727
  /* "pandas/lib/src/tseries.pyx":250
 
2728
 *     mask = <char *> maskVec.data
 
2729
 * 
 
2730
 *     newLength = PyArray_SIZE(fillVec)             # <<<<<<<<<<<<<<
 
2731
 * 
 
2732
 *     length = PyArray_SIZE(oldIndex)
 
2733
 */
 
2734
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_fillVec), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2735
  __pyx_v_newLength = PyArray_SIZE(((PyArrayObject *)__pyx_v_fillVec));
 
2736
 
 
2737
  /* "pandas/lib/src/tseries.pyx":252
 
2738
 *     newLength = PyArray_SIZE(fillVec)
 
2739
 * 
 
2740
 *     length = PyArray_SIZE(oldIndex)             # <<<<<<<<<<<<<<
 
2741
 *     iterold = PyArray_IterNew(oldIndex)
 
2742
 * 
 
2743
 */
 
2744
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_oldIndex), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2745
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_oldIndex));
 
2746
 
 
2747
  /* "pandas/lib/src/tseries.pyx":253
 
2748
 * 
 
2749
 *     length = PyArray_SIZE(oldIndex)
 
2750
 *     iterold = PyArray_IterNew(oldIndex)             # <<<<<<<<<<<<<<
 
2751
 * 
 
2752
 *     for i from 0 <= i < length:
 
2753
 */
 
2754
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_oldIndex)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2755
  __Pyx_GOTREF(__pyx_t_4);
 
2756
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2757
  __Pyx_DECREF(((PyObject *)__pyx_v_iterold));
 
2758
  __pyx_v_iterold = ((PyArrayIterObject *)__pyx_t_4);
 
2759
  __pyx_t_4 = 0;
 
2760
 
 
2761
  /* "pandas/lib/src/tseries.pyx":255
 
2762
 *     iterold = PyArray_IterNew(oldIndex)
 
2763
 * 
 
2764
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
2765
 *         idx = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)
 
2766
 *         if i < length - 1:
 
2767
 */
 
2768
  __pyx_t_5 = __pyx_v_length;
 
2769
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
2770
 
 
2771
    /* "pandas/lib/src/tseries.pyx":256
 
2772
 * 
 
2773
 *     for i from 0 <= i < length:
 
2774
 *         idx = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)             # <<<<<<<<<<<<<<
 
2775
 *         if i < length - 1:
 
2776
 *            PyArray_ITER_NEXT(iterold)
 
2777
 */
 
2778
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_oldIndex), ((void *)__pyx_v_iterold->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2779
    __Pyx_GOTREF(__pyx_t_4);
 
2780
    __Pyx_DECREF(__pyx_v_idx);
 
2781
    __pyx_v_idx = __pyx_t_4;
 
2782
    __pyx_t_4 = 0;
 
2783
 
 
2784
    /* "pandas/lib/src/tseries.pyx":257
 
2785
 *     for i from 0 <= i < length:
 
2786
 *         idx = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)
 
2787
 *         if i < length - 1:             # <<<<<<<<<<<<<<
 
2788
 *            PyArray_ITER_NEXT(iterold)
 
2789
 *         if idx in newMap:
 
2790
 */
 
2791
    __pyx_t_6 = (__pyx_v_i < (__pyx_v_length - 1));
 
2792
    if (__pyx_t_6) {
 
2793
 
 
2794
      /* "pandas/lib/src/tseries.pyx":258
 
2795
 *         idx = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)
 
2796
 *         if i < length - 1:
 
2797
 *            PyArray_ITER_NEXT(iterold)             # <<<<<<<<<<<<<<
 
2798
 *         if idx in newMap:
 
2799
 *             j = newMap[idx]
 
2800
 */
 
2801
      PyArray_ITER_NEXT(__pyx_v_iterold);
 
2802
      goto __pyx_L5;
 
2803
    }
 
2804
    __pyx_L5:;
 
2805
 
 
2806
    /* "pandas/lib/src/tseries.pyx":259
 
2807
 *         if i < length - 1:
 
2808
 *            PyArray_ITER_NEXT(iterold)
 
2809
 *         if idx in newMap:             # <<<<<<<<<<<<<<
 
2810
 *             j = newMap[idx]
 
2811
 *             fillLocs[j] = i
 
2812
 */
 
2813
    __pyx_t_6 = (PySequence_Contains(((PyObject *)__pyx_v_newMap), __pyx_v_idx)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2814
    if (__pyx_t_6) {
 
2815
 
 
2816
      /* "pandas/lib/src/tseries.pyx":260
 
2817
 *            PyArray_ITER_NEXT(iterold)
 
2818
 *         if idx in newMap:
 
2819
 *             j = newMap[idx]             # <<<<<<<<<<<<<<
 
2820
 *             fillLocs[j] = i
 
2821
 *             mask[j] = 1
 
2822
 */
 
2823
      __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_newMap), __pyx_v_idx); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2824
      __Pyx_GOTREF(__pyx_2);
 
2825
      __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2826
      __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
2827
      __pyx_v_j = __pyx_t_7;
 
2828
 
 
2829
      /* "pandas/lib/src/tseries.pyx":261
 
2830
 *         if idx in newMap:
 
2831
 *             j = newMap[idx]
 
2832
 *             fillLocs[j] = i             # <<<<<<<<<<<<<<
 
2833
 *             mask[j] = 1
 
2834
 * 
 
2835
 */
 
2836
      (__pyx_v_fillLocs[__pyx_v_j]) = __pyx_v_i;
 
2837
 
 
2838
      /* "pandas/lib/src/tseries.pyx":262
 
2839
 *             j = newMap[idx]
 
2840
 *             fillLocs[j] = i
 
2841
 *             mask[j] = 1             # <<<<<<<<<<<<<<
 
2842
 * 
 
2843
 *     for i from 0 <= i < newLength:
 
2844
 */
 
2845
      (__pyx_v_mask[__pyx_v_j]) = 1;
 
2846
      goto __pyx_L6;
 
2847
    }
 
2848
    __pyx_L6:;
 
2849
  }
 
2850
 
 
2851
  /* "pandas/lib/src/tseries.pyx":264
 
2852
 *             mask[j] = 1
 
2853
 * 
 
2854
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 
2855
 *         if mask[i] == 0:
 
2856
 *             fillLocs[i] = -1
 
2857
 */
 
2858
  __pyx_t_5 = __pyx_v_newLength;
 
2859
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
2860
 
 
2861
    /* "pandas/lib/src/tseries.pyx":265
 
2862
 * 
 
2863
 *     for i from 0 <= i < newLength:
 
2864
 *         if mask[i] == 0:             # <<<<<<<<<<<<<<
 
2865
 *             fillLocs[i] = -1
 
2866
 * 
 
2867
 */
 
2868
    __pyx_t_6 = ((__pyx_v_mask[__pyx_v_i]) == 0);
 
2869
    if (__pyx_t_6) {
 
2870
 
 
2871
      /* "pandas/lib/src/tseries.pyx":266
 
2872
 *     for i from 0 <= i < newLength:
 
2873
 *         if mask[i] == 0:
 
2874
 *             fillLocs[i] = -1             # <<<<<<<<<<<<<<
 
2875
 * 
 
2876
 *     return fillVec, maskVec
 
2877
 */
 
2878
      (__pyx_v_fillLocs[__pyx_v_i]) = -1;
 
2879
      goto __pyx_L9;
 
2880
    }
 
2881
    __pyx_L9:;
 
2882
  }
 
2883
 
 
2884
  /* "pandas/lib/src/tseries.pyx":268
 
2885
 *             fillLocs[i] = -1
 
2886
 * 
 
2887
 *     return fillVec, maskVec             # <<<<<<<<<<<<<<
 
2888
 * 
 
2889
 * cdef tuple _backfill(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):
 
2890
 */
 
2891
  __Pyx_XDECREF(((PyObject *)__pyx_r));
 
2892
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2893
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
2894
  __Pyx_INCREF(((PyObject *)__pyx_v_fillVec));
 
2895
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fillVec));
 
2896
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec));
 
2897
  __Pyx_INCREF(((PyObject *)__pyx_v_maskVec));
 
2898
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_maskVec));
 
2899
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maskVec));
 
2900
  __pyx_r = __pyx_t_4;
 
2901
  __pyx_t_4 = 0;
 
2902
  goto __pyx_L0;
 
2903
 
 
2904
  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
2905
  goto __pyx_L0;
 
2906
  __pyx_L1_error:;
 
2907
  __Pyx_XDECREF(__pyx_1);
 
2908
  __Pyx_XDECREF(__pyx_2);
 
2909
  __Pyx_XDECREF(__pyx_t_1);
 
2910
  __Pyx_XDECREF(__pyx_t_3);
 
2911
  __Pyx_XDECREF(__pyx_t_4);
 
2912
  __Pyx_AddTraceback("tseries._nofill");
 
2913
  __pyx_r = 0;
 
2914
  __pyx_L0:;
 
2915
  __Pyx_DECREF((PyObject *)__pyx_v_iterold);
 
2916
  __Pyx_DECREF(__pyx_v_idx);
 
2917
  __Pyx_DECREF((PyObject *)__pyx_v_fillVec);
 
2918
  __Pyx_DECREF((PyObject *)__pyx_v_maskVec);
 
2919
  __Pyx_XGIVEREF(__pyx_r);
 
2920
  __Pyx_FinishRefcountContext();
 
2921
  return __pyx_r;
 
2922
}
 
2923
 
 
2924
/* "pandas/lib/src/tseries.pyx":270
 
2925
 *     return fillVec, maskVec
 
2926
 * 
 
2927
 * cdef tuple _backfill(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):             # <<<<<<<<<<<<<<
 
2928
 *     '''
 
2929
 *     Backfilling logic for generating fill vector
 
2930
 */
 
2931
 
 
2932
static  PyObject *__pyx_f_7tseries__backfill(PyArrayObject *__pyx_v_oldIndex, PyArrayObject *__pyx_v_newIndex, PyObject *__pyx_v_oldMap, PyObject *__pyx_v_newMap) {
 
2933
  int __pyx_v_i;
 
2934
  int __pyx_v_oldLength;
 
2935
  int __pyx_v_newLength;
 
2936
  int __pyx_v_curLoc;
 
2937
  PyArrayObject *__pyx_v_fillVec;
 
2938
  PyArrayObject *__pyx_v_maskVec;
 
2939
  int *__pyx_v_fillLocs;
 
2940
  char *__pyx_v_mask;
 
2941
  PyArrayIterObject *__pyx_v_iterold;
 
2942
  PyArrayIterObject *__pyx_v_iternew;
 
2943
  int __pyx_v_newPos;
 
2944
  int __pyx_v_oldPos;
 
2945
  PyObject *__pyx_v_prevOld;
 
2946
  PyObject *__pyx_v_curOld;
 
2947
  PyObject *__pyx_r = NULL;
 
2948
  PyObject *__pyx_1 = 0;
 
2949
  PyObject *__pyx_2 = 0;
 
2950
  PyObject *__pyx_t_1 = NULL;
 
2951
  Py_ssize_t __pyx_t_2;
 
2952
  PyObject *__pyx_t_3 = NULL;
 
2953
  PyObject *__pyx_t_4 = NULL;
 
2954
  int __pyx_t_5;
 
2955
  int __pyx_t_6;
 
2956
  __Pyx_SetupRefcountContext("_backfill");
 
2957
  __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
2958
  __pyx_v_maskVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
2959
  __pyx_v_iterold = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
2960
  __pyx_v_iternew = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
2961
  __pyx_v_prevOld = Py_None; __Pyx_INCREF(Py_None);
 
2962
  __pyx_v_curOld = Py_None; __Pyx_INCREF(Py_None);
 
2963
 
 
2964
  /* "pandas/lib/src/tseries.pyx":299
 
2965
 *     cdef ndarray fillVec
 
2966
 *     cdef ndarray maskVec
 
2967
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)             # <<<<<<<<<<<<<<
 
2968
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)
 
2969
 * 
 
2970
 */
 
2971
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2972
  __Pyx_GOTREF(__pyx_1);
 
2973
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2974
  __Pyx_GOTREF(__pyx_t_1);
 
2975
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
2976
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2977
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2978
  __Pyx_GOTREF(__pyx_t_3);
 
2979
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2980
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
2981
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
 
2982
  __Pyx_GIVEREF(__pyx_t_3);
 
2983
  __pyx_t_3 = 0;
 
2984
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2985
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
2986
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2987
  __Pyx_GOTREF(__pyx_2);
 
2988
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_33); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2989
  __Pyx_GOTREF(__pyx_t_3);
 
2990
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
2991
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2992
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
2993
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2994
  __Pyx_GOTREF(__pyx_t_3);
 
2995
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2996
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
2997
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
2998
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
 
2999
  __Pyx_DECREF(((PyObject *)__pyx_v_fillVec));
 
3000
  __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_3);
 
3001
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3002
 
 
3003
  /* "pandas/lib/src/tseries.pyx":300
 
3004
 *     cdef ndarray maskVec
 
3005
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)
 
3006
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)             # <<<<<<<<<<<<<<
 
3007
 * 
 
3008
 *     # Get references
 
3009
 */
 
3010
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3011
  __Pyx_GOTREF(__pyx_2);
 
3012
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3013
  __Pyx_GOTREF(__pyx_t_3);
 
3014
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
3015
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3016
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3017
  __Pyx_GOTREF(__pyx_t_4);
 
3018
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3019
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
3020
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
 
3021
  __Pyx_GIVEREF(__pyx_t_4);
 
3022
  __pyx_t_4 = 0;
 
3023
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3024
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
3025
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3026
  __Pyx_GOTREF(__pyx_2);
 
3027
  __pyx_t_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_34); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3028
  __Pyx_GOTREF(__pyx_t_4);
 
3029
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
3030
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3031
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3032
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3033
  __Pyx_GOTREF(__pyx_t_4);
 
3034
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3035
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
3036
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
3037
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
3038
  __Pyx_DECREF(((PyObject *)__pyx_v_maskVec));
 
3039
  __pyx_v_maskVec = ((PyArrayObject *)__pyx_t_4);
 
3040
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3041
 
 
3042
  /* "pandas/lib/src/tseries.pyx":305
 
3043
 *     cdef int *fillLocs
 
3044
 *     cdef char *mask
 
3045
 *     fillLocs = <int *> fillVec.data             # <<<<<<<<<<<<<<
 
3046
 *     mask = <char *> maskVec.data
 
3047
 * 
 
3048
 */
 
3049
  __pyx_v_fillLocs = ((int *)__pyx_v_fillVec->data);
 
3050
 
 
3051
  /* "pandas/lib/src/tseries.pyx":306
 
3052
 *     cdef char *mask
 
3053
 *     fillLocs = <int *> fillVec.data
 
3054
 *     mask = <char *> maskVec.data             # <<<<<<<<<<<<<<
 
3055
 * 
 
3056
 *     # Create the iterators
 
3057
 */
 
3058
  __pyx_v_mask = ((char *)__pyx_v_maskVec->data);
 
3059
 
 
3060
  /* "pandas/lib/src/tseries.pyx":310
 
3061
 *     # Create the iterators
 
3062
 *     cdef flatiter iterold, iternew
 
3063
 *     iterold = PyArray_IterNew(oldIndex)             # <<<<<<<<<<<<<<
 
3064
 *     iternew = PyArray_IterNew(newIndex)
 
3065
 * 
 
3066
 */
 
3067
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_oldIndex)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3068
  __Pyx_GOTREF(__pyx_t_4);
 
3069
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3070
  __Pyx_DECREF(((PyObject *)__pyx_v_iterold));
 
3071
  __pyx_v_iterold = ((PyArrayIterObject *)__pyx_t_4);
 
3072
  __pyx_t_4 = 0;
 
3073
 
 
3074
  /* "pandas/lib/src/tseries.pyx":311
 
3075
 *     cdef flatiter iterold, iternew
 
3076
 *     iterold = PyArray_IterNew(oldIndex)
 
3077
 *     iternew = PyArray_IterNew(newIndex)             # <<<<<<<<<<<<<<
 
3078
 * 
 
3079
 *     # Get the size
 
3080
 */
 
3081
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_newIndex)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3082
  __Pyx_GOTREF(__pyx_t_4);
 
3083
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3084
  __Pyx_DECREF(((PyObject *)__pyx_v_iternew));
 
3085
  __pyx_v_iternew = ((PyArrayIterObject *)__pyx_t_4);
 
3086
  __pyx_t_4 = 0;
 
3087
 
 
3088
  /* "pandas/lib/src/tseries.pyx":314
 
3089
 * 
 
3090
 *     # Get the size
 
3091
 *     oldLength = PyArray_SIZE(oldIndex)             # <<<<<<<<<<<<<<
 
3092
 *     newLength = PyArray_SIZE(newIndex)
 
3093
 * 
 
3094
 */
 
3095
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_oldIndex), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3096
  __pyx_v_oldLength = PyArray_SIZE(((PyArrayObject *)__pyx_v_oldIndex));
 
3097
 
 
3098
  /* "pandas/lib/src/tseries.pyx":315
 
3099
 *     # Get the size
 
3100
 *     oldLength = PyArray_SIZE(oldIndex)
 
3101
 *     newLength = PyArray_SIZE(newIndex)             # <<<<<<<<<<<<<<
 
3102
 * 
 
3103
 *     # Current positions
 
3104
 */
 
3105
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_newIndex), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3106
  __pyx_v_newLength = PyArray_SIZE(((PyArrayObject *)__pyx_v_newIndex));
 
3107
 
 
3108
  /* "pandas/lib/src/tseries.pyx":319
 
3109
 *     # Current positions
 
3110
 *     cdef int newPos, oldPos
 
3111
 *     oldPos = oldLength - 1             # <<<<<<<<<<<<<<
 
3112
 *     newPos = newLength - 1
 
3113
 * 
 
3114
 */
 
3115
  __pyx_v_oldPos = (__pyx_v_oldLength - 1);
 
3116
 
 
3117
  /* "pandas/lib/src/tseries.pyx":320
 
3118
 *     cdef int newPos, oldPos
 
3119
 *     oldPos = oldLength - 1
 
3120
 *     newPos = newLength - 1             # <<<<<<<<<<<<<<
 
3121
 * 
 
3122
 *     # References holding indices
 
3123
 */
 
3124
  __pyx_v_newPos = (__pyx_v_newLength - 1);
 
3125
 
 
3126
  /* "pandas/lib/src/tseries.pyx":325
 
3127
 *     cdef object prevOld, curOld
 
3128
 * 
 
3129
 *     while newPos >= 0:             # <<<<<<<<<<<<<<
 
3130
 *         # Move to the current position
 
3131
 *         PyArray_ITER_GOTO1D(iternew, newPos)
 
3132
 */
 
3133
  while (1) {
 
3134
    __pyx_t_5 = (__pyx_v_newPos >= 0);
 
3135
    if (!__pyx_t_5) break;
 
3136
 
 
3137
    /* "pandas/lib/src/tseries.pyx":327
 
3138
 *     while newPos >= 0:
 
3139
 *         # Move to the current position
 
3140
 *         PyArray_ITER_GOTO1D(iternew, newPos)             # <<<<<<<<<<<<<<
 
3141
 *         PyArray_ITER_GOTO1D(iterold, oldPos)
 
3142
 * 
 
3143
 */
 
3144
    PyArray_ITER_GOTO1D(__pyx_v_iternew, __pyx_v_newPos);
 
3145
 
 
3146
    /* "pandas/lib/src/tseries.pyx":328
 
3147
 *         # Move to the current position
 
3148
 *         PyArray_ITER_GOTO1D(iternew, newPos)
 
3149
 *         PyArray_ITER_GOTO1D(iterold, oldPos)             # <<<<<<<<<<<<<<
 
3150
 * 
 
3151
 *         # Get the current index
 
3152
 */
 
3153
    PyArray_ITER_GOTO1D(__pyx_v_iterold, __pyx_v_oldPos);
 
3154
 
 
3155
    /* "pandas/lib/src/tseries.pyx":331
 
3156
 * 
 
3157
 *         # Get the current index
 
3158
 *         curOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)             # <<<<<<<<<<<<<<
 
3159
 * 
 
3160
 *         # Until we reach a point where we are before the curOld point
 
3161
 */
 
3162
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_oldIndex), ((void *)__pyx_v_iterold->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3163
    __Pyx_GOTREF(__pyx_t_4);
 
3164
    __Pyx_DECREF(__pyx_v_curOld);
 
3165
    __pyx_v_curOld = __pyx_t_4;
 
3166
    __pyx_t_4 = 0;
 
3167
 
 
3168
    /* "pandas/lib/src/tseries.pyx":334
 
3169
 * 
 
3170
 *         # Until we reach a point where we are before the curOld point
 
3171
 *         while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) > curOld:             # <<<<<<<<<<<<<<
 
3172
 *             newPos -= 1
 
3173
 *             if newPos < 0:
 
3174
 */
 
3175
    while (1) {
 
3176
      __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_newIndex), ((void *)__pyx_v_iternew->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3177
      __Pyx_GOTREF(__pyx_t_4);
 
3178
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_curOld, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3179
      __Pyx_GOTREF(__pyx_t_1);
 
3180
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3181
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3182
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3183
      if (!__pyx_t_5) break;
 
3184
 
 
3185
      /* "pandas/lib/src/tseries.pyx":335
 
3186
 *         # Until we reach a point where we are before the curOld point
 
3187
 *         while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) > curOld:
 
3188
 *             newPos -= 1             # <<<<<<<<<<<<<<
 
3189
 *             if newPos < 0:
 
3190
 *                 break
 
3191
 */
 
3192
      __pyx_v_newPos -= 1;
 
3193
 
 
3194
      /* "pandas/lib/src/tseries.pyx":336
 
3195
 *         while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) > curOld:
 
3196
 *             newPos -= 1
 
3197
 *             if newPos < 0:             # <<<<<<<<<<<<<<
 
3198
 *                 break
 
3199
 *             PyArray_ITER_GOTO1D(iternew, newPos)
 
3200
 */
 
3201
      __pyx_t_5 = (__pyx_v_newPos < 0);
 
3202
      if (__pyx_t_5) {
 
3203
 
 
3204
        /* "pandas/lib/src/tseries.pyx":337
 
3205
 *             newPos -= 1
 
3206
 *             if newPos < 0:
 
3207
 *                 break             # <<<<<<<<<<<<<<
 
3208
 *             PyArray_ITER_GOTO1D(iternew, newPos)
 
3209
 * 
 
3210
 */
 
3211
        goto __pyx_L6_break;
 
3212
        goto __pyx_L7;
 
3213
      }
 
3214
      __pyx_L7:;
 
3215
 
 
3216
      /* "pandas/lib/src/tseries.pyx":338
 
3217
 *             if newPos < 0:
 
3218
 *                 break
 
3219
 *             PyArray_ITER_GOTO1D(iternew, newPos)             # <<<<<<<<<<<<<<
 
3220
 * 
 
3221
 *         # Get the location in the old index
 
3222
 */
 
3223
      PyArray_ITER_GOTO1D(__pyx_v_iternew, __pyx_v_newPos);
 
3224
    }
 
3225
    __pyx_L6_break:;
 
3226
 
 
3227
    /* "pandas/lib/src/tseries.pyx":341
 
3228
 * 
 
3229
 *         # Get the location in the old index
 
3230
 *         curLoc = oldMap[curOld]             # <<<<<<<<<<<<<<
 
3231
 * 
 
3232
 *         # At the beginning of the old index
 
3233
 */
 
3234
    __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_curOld); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3235
    __Pyx_GOTREF(__pyx_2);
 
3236
    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3237
    __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
3238
    __pyx_v_curLoc = __pyx_t_6;
 
3239
 
 
3240
    /* "pandas/lib/src/tseries.pyx":344
 
3241
 * 
 
3242
 *         # At the beginning of the old index
 
3243
 *         if oldPos == 0:             # <<<<<<<<<<<<<<
 
3244
 * 
 
3245
 *             # Make sure we are before the curOld index
 
3246
 */
 
3247
    __pyx_t_5 = (__pyx_v_oldPos == 0);
 
3248
    if (__pyx_t_5) {
 
3249
 
 
3250
      /* "pandas/lib/src/tseries.pyx":347
 
3251
 * 
 
3252
 *             # Make sure we are before the curOld index
 
3253
 *             if PyArray_GETITEM(newIndex, <void *> iternew.dataptr) <= curOld:             # <<<<<<<<<<<<<<
 
3254
 *                 fillVec[:newPos + 1] = curLoc
 
3255
 *                 maskVec[:newPos + 1] = 1
 
3256
 */
 
3257
      __pyx_t_1 = PyArray_GETITEM(((PyObject *)__pyx_v_newIndex), ((void *)__pyx_v_iternew->dataptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3258
      __Pyx_GOTREF(__pyx_t_1);
 
3259
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_curOld, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3260
      __Pyx_GOTREF(__pyx_t_4);
 
3261
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3262
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3263
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3264
      if (__pyx_t_5) {
 
3265
 
 
3266
        /* "pandas/lib/src/tseries.pyx":348
 
3267
 *             # Make sure we are before the curOld index
 
3268
 *             if PyArray_GETITEM(newIndex, <void *> iternew.dataptr) <= curOld:
 
3269
 *                 fillVec[:newPos + 1] = curLoc             # <<<<<<<<<<<<<<
 
3270
 *                 maskVec[:newPos + 1] = 1
 
3271
 * 
 
3272
 */
 
3273
        __pyx_t_4 = PyInt_FromLong(__pyx_v_curLoc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3274
        __Pyx_GOTREF(__pyx_t_4);
 
3275
        if (PySequence_SetSlice(((PyObject *)__pyx_v_fillVec), 0, (__pyx_v_newPos + 1), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3276
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3277
 
 
3278
        /* "pandas/lib/src/tseries.pyx":349
 
3279
 *             if PyArray_GETITEM(newIndex, <void *> iternew.dataptr) <= curOld:
 
3280
 *                 fillVec[:newPos + 1] = curLoc
 
3281
 *                 maskVec[:newPos + 1] = 1             # <<<<<<<<<<<<<<
 
3282
 * 
 
3283
 *             # Exit the main loop
 
3284
 */
 
3285
        if (PySequence_SetSlice(((PyObject *)__pyx_v_maskVec), 0, (__pyx_v_newPos + 1), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3286
        goto __pyx_L9;
 
3287
      }
 
3288
      __pyx_L9:;
 
3289
 
 
3290
      /* "pandas/lib/src/tseries.pyx":352
 
3291
 * 
 
3292
 *             # Exit the main loop
 
3293
 *             break             # <<<<<<<<<<<<<<
 
3294
 * 
 
3295
 *         else:
 
3296
 */
 
3297
      goto __pyx_L4_break;
 
3298
      goto __pyx_L8;
 
3299
    }
 
3300
    /*else*/ {
 
3301
 
 
3302
      /* "pandas/lib/src/tseries.pyx":356
 
3303
 *         else:
 
3304
 *             # Move one position back
 
3305
 *             PyArray_ITER_GOTO1D(iterold, oldPos - 1)             # <<<<<<<<<<<<<<
 
3306
 * 
 
3307
 *             # Get the index there
 
3308
 */
 
3309
      PyArray_ITER_GOTO1D(__pyx_v_iterold, (__pyx_v_oldPos - 1));
 
3310
 
 
3311
      /* "pandas/lib/src/tseries.pyx":359
 
3312
 * 
 
3313
 *             # Get the index there
 
3314
 *             prevOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)             # <<<<<<<<<<<<<<
 
3315
 * 
 
3316
 *             # Until we reach the previous index
 
3317
 */
 
3318
      __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_oldIndex), ((void *)__pyx_v_iterold->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3319
      __Pyx_GOTREF(__pyx_t_4);
 
3320
      __Pyx_DECREF(__pyx_v_prevOld);
 
3321
      __pyx_v_prevOld = __pyx_t_4;
 
3322
      __pyx_t_4 = 0;
 
3323
 
 
3324
      /* "pandas/lib/src/tseries.pyx":362
 
3325
 * 
 
3326
 *             # Until we reach the previous index
 
3327
 *             while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) > prevOld:             # <<<<<<<<<<<<<<
 
3328
 * 
 
3329
 *                 # Set the current fill location
 
3330
 */
 
3331
      while (1) {
 
3332
        __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_newIndex), ((void *)__pyx_v_iternew->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3333
        __Pyx_GOTREF(__pyx_t_4);
 
3334
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_prevOld, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3335
        __Pyx_GOTREF(__pyx_t_1);
 
3336
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3337
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3338
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3339
        if (!__pyx_t_5) break;
 
3340
 
 
3341
        /* "pandas/lib/src/tseries.pyx":365
 
3342
 * 
 
3343
 *                 # Set the current fill location
 
3344
 *                 fillLocs[newPos] = curLoc             # <<<<<<<<<<<<<<
 
3345
 *                 mask[newPos] = 1
 
3346
 * 
 
3347
 */
 
3348
        (__pyx_v_fillLocs[__pyx_v_newPos]) = __pyx_v_curLoc;
 
3349
 
 
3350
        /* "pandas/lib/src/tseries.pyx":366
 
3351
 *                 # Set the current fill location
 
3352
 *                 fillLocs[newPos] = curLoc
 
3353
 *                 mask[newPos] = 1             # <<<<<<<<<<<<<<
 
3354
 * 
 
3355
 *                 newPos -= 1
 
3356
 */
 
3357
        (__pyx_v_mask[__pyx_v_newPos]) = 1;
 
3358
 
 
3359
        /* "pandas/lib/src/tseries.pyx":368
 
3360
 *                 mask[newPos] = 1
 
3361
 * 
 
3362
 *                 newPos -= 1             # <<<<<<<<<<<<<<
 
3363
 *                 if newPos < 0:
 
3364
 *                     break
 
3365
 */
 
3366
        __pyx_v_newPos -= 1;
 
3367
 
 
3368
        /* "pandas/lib/src/tseries.pyx":369
 
3369
 * 
 
3370
 *                 newPos -= 1
 
3371
 *                 if newPos < 0:             # <<<<<<<<<<<<<<
 
3372
 *                     break
 
3373
 * 
 
3374
 */
 
3375
        __pyx_t_5 = (__pyx_v_newPos < 0);
 
3376
        if (__pyx_t_5) {
 
3377
 
 
3378
          /* "pandas/lib/src/tseries.pyx":370
 
3379
 *                 newPos -= 1
 
3380
 *                 if newPos < 0:
 
3381
 *                     break             # <<<<<<<<<<<<<<
 
3382
 * 
 
3383
 *                 # Move the iterator back
 
3384
 */
 
3385
          goto __pyx_L11_break;
 
3386
          goto __pyx_L12;
 
3387
        }
 
3388
        __pyx_L12:;
 
3389
 
 
3390
        /* "pandas/lib/src/tseries.pyx":373
 
3391
 * 
 
3392
 *                 # Move the iterator back
 
3393
 *                 PyArray_ITER_GOTO1D(iternew, newPos)             # <<<<<<<<<<<<<<
 
3394
 * 
 
3395
 *         # Move one period back
 
3396
 */
 
3397
        PyArray_ITER_GOTO1D(__pyx_v_iternew, __pyx_v_newPos);
 
3398
      }
 
3399
      __pyx_L11_break:;
 
3400
    }
 
3401
    __pyx_L8:;
 
3402
 
 
3403
    /* "pandas/lib/src/tseries.pyx":376
 
3404
 * 
 
3405
 *         # Move one period back
 
3406
 *         oldPos -= 1             # <<<<<<<<<<<<<<
 
3407
 * 
 
3408
 *     for i from 0 <= i < newLength:
 
3409
 */
 
3410
    __pyx_v_oldPos -= 1;
 
3411
  }
 
3412
  __pyx_L4_break:;
 
3413
 
 
3414
  /* "pandas/lib/src/tseries.pyx":378
 
3415
 *         oldPos -= 1
 
3416
 * 
 
3417
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 
3418
 *         if mask[i] == 0:
 
3419
 *             # Fill from some generic location
 
3420
 */
 
3421
  __pyx_t_6 = __pyx_v_newLength;
 
3422
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
 
3423
 
 
3424
    /* "pandas/lib/src/tseries.pyx":379
 
3425
 * 
 
3426
 *     for i from 0 <= i < newLength:
 
3427
 *         if mask[i] == 0:             # <<<<<<<<<<<<<<
 
3428
 *             # Fill from some generic location
 
3429
 *             fillLocs[i] = -1
 
3430
 */
 
3431
    __pyx_t_5 = ((__pyx_v_mask[__pyx_v_i]) == 0);
 
3432
    if (__pyx_t_5) {
 
3433
 
 
3434
      /* "pandas/lib/src/tseries.pyx":381
 
3435
 *         if mask[i] == 0:
 
3436
 *             # Fill from some generic location
 
3437
 *             fillLocs[i] = -1             # <<<<<<<<<<<<<<
 
3438
 * 
 
3439
 *     return (fillVec, maskVec)
 
3440
 */
 
3441
      (__pyx_v_fillLocs[__pyx_v_i]) = -1;
 
3442
      goto __pyx_L15;
 
3443
    }
 
3444
    __pyx_L15:;
 
3445
  }
 
3446
 
 
3447
  /* "pandas/lib/src/tseries.pyx":383
 
3448
 *             fillLocs[i] = -1
 
3449
 * 
 
3450
 *     return (fillVec, maskVec)             # <<<<<<<<<<<<<<
 
3451
 * 
 
3452
 * cdef tuple _pad(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):
 
3453
 */
 
3454
  __Pyx_XDECREF(((PyObject *)__pyx_r));
 
3455
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3456
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
3457
  __Pyx_INCREF(((PyObject *)__pyx_v_fillVec));
 
3458
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fillVec));
 
3459
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec));
 
3460
  __Pyx_INCREF(((PyObject *)__pyx_v_maskVec));
 
3461
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_maskVec));
 
3462
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maskVec));
 
3463
  __pyx_r = __pyx_t_1;
 
3464
  __pyx_t_1 = 0;
 
3465
  goto __pyx_L0;
 
3466
 
 
3467
  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
3468
  goto __pyx_L0;
 
3469
  __pyx_L1_error:;
 
3470
  __Pyx_XDECREF(__pyx_1);
 
3471
  __Pyx_XDECREF(__pyx_2);
 
3472
  __Pyx_XDECREF(__pyx_t_1);
 
3473
  __Pyx_XDECREF(__pyx_t_3);
 
3474
  __Pyx_XDECREF(__pyx_t_4);
 
3475
  __Pyx_AddTraceback("tseries._backfill");
 
3476
  __pyx_r = 0;
 
3477
  __pyx_L0:;
 
3478
  __Pyx_DECREF((PyObject *)__pyx_v_fillVec);
 
3479
  __Pyx_DECREF((PyObject *)__pyx_v_maskVec);
 
3480
  __Pyx_DECREF((PyObject *)__pyx_v_iterold);
 
3481
  __Pyx_DECREF((PyObject *)__pyx_v_iternew);
 
3482
  __Pyx_DECREF(__pyx_v_prevOld);
 
3483
  __Pyx_DECREF(__pyx_v_curOld);
 
3484
  __Pyx_XGIVEREF(__pyx_r);
 
3485
  __Pyx_FinishRefcountContext();
 
3486
  return __pyx_r;
 
3487
}
 
3488
 
 
3489
/* "pandas/lib/src/tseries.pyx":385
 
3490
 *     return (fillVec, maskVec)
 
3491
 * 
 
3492
 * cdef tuple _pad(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):             # <<<<<<<<<<<<<<
 
3493
 *     '''
 
3494
 *     Padding logic for generating fill vector
 
3495
 */
 
3496
 
 
3497
static  PyObject *__pyx_f_7tseries__pad(PyArrayObject *__pyx_v_oldIndex, PyArrayObject *__pyx_v_newIndex, PyObject *__pyx_v_oldMap, PyObject *__pyx_v_newMap) {
 
3498
  PyArrayObject *__pyx_v_fillVec;
 
3499
  PyArrayObject *__pyx_v_maskVec;
 
3500
  int *__pyx_v_fillLocs;
 
3501
  char *__pyx_v_mask;
 
3502
  int __pyx_v_i;
 
3503
  int __pyx_v_oldLength;
 
3504
  int __pyx_v_newLength;
 
3505
  int __pyx_v_curLoc;
 
3506
  int __pyx_v_newPos;
 
3507
  int __pyx_v_oldPos;
 
3508
  PyArrayIterObject *__pyx_v_iterold;
 
3509
  PyArrayIterObject *__pyx_v_iternew;
 
3510
  PyObject *__pyx_v_nextOld;
 
3511
  PyObject *__pyx_v_curOld;
 
3512
  char __pyx_v_done;
 
3513
  PyObject *__pyx_r = NULL;
 
3514
  PyObject *__pyx_1 = 0;
 
3515
  PyObject *__pyx_2 = 0;
 
3516
  PyObject *__pyx_t_1 = NULL;
 
3517
  Py_ssize_t __pyx_t_2;
 
3518
  PyObject *__pyx_t_3 = NULL;
 
3519
  PyObject *__pyx_t_4 = NULL;
 
3520
  int __pyx_t_5;
 
3521
  int __pyx_t_6;
 
3522
  char __pyx_t_7;
 
3523
  __Pyx_SetupRefcountContext("_pad");
 
3524
  __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
3525
  __pyx_v_maskVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
3526
  __pyx_v_iterold = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
3527
  __pyx_v_iternew = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
3528
  __pyx_v_nextOld = Py_None; __Pyx_INCREF(Py_None);
 
3529
  __pyx_v_curOld = Py_None; __Pyx_INCREF(Py_None);
 
3530
 
 
3531
  /* "pandas/lib/src/tseries.pyx":419
 
3532
 * 
 
3533
 *     # Make empty fill vector and mask vector, cast to ndarray
 
3534
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)             # <<<<<<<<<<<<<<
 
3535
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)
 
3536
 * 
 
3537
 */
 
3538
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3539
  __Pyx_GOTREF(__pyx_1);
 
3540
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3541
  __Pyx_GOTREF(__pyx_t_1);
 
3542
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
3543
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3544
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3545
  __Pyx_GOTREF(__pyx_t_3);
 
3546
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3547
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
3548
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
 
3549
  __Pyx_GIVEREF(__pyx_t_3);
 
3550
  __pyx_t_3 = 0;
 
3551
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3552
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
3553
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3554
  __Pyx_GOTREF(__pyx_2);
 
3555
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_33); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3556
  __Pyx_GOTREF(__pyx_t_3);
 
3557
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
3558
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3559
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3560
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3561
  __Pyx_GOTREF(__pyx_t_3);
 
3562
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3563
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
3564
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
3565
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
 
3566
  __Pyx_DECREF(((PyObject *)__pyx_v_fillVec));
 
3567
  __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_3);
 
3568
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3569
 
 
3570
  /* "pandas/lib/src/tseries.pyx":420
 
3571
 *     # Make empty fill vector and mask vector, cast to ndarray
 
3572
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)
 
3573
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)             # <<<<<<<<<<<<<<
 
3574
 * 
 
3575
 *     # Get reference to the arrays inside
 
3576
 */
 
3577
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3578
  __Pyx_GOTREF(__pyx_2);
 
3579
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3580
  __Pyx_GOTREF(__pyx_t_3);
 
3581
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
3582
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3583
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3584
  __Pyx_GOTREF(__pyx_t_4);
 
3585
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3586
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
3587
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
 
3588
  __Pyx_GIVEREF(__pyx_t_4);
 
3589
  __pyx_t_4 = 0;
 
3590
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3591
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
3592
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3593
  __Pyx_GOTREF(__pyx_2);
 
3594
  __pyx_t_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_34); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3595
  __Pyx_GOTREF(__pyx_t_4);
 
3596
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
3597
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3598
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3599
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3600
  __Pyx_GOTREF(__pyx_t_4);
 
3601
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3602
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
3603
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
3604
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
3605
  __Pyx_DECREF(((PyObject *)__pyx_v_maskVec));
 
3606
  __pyx_v_maskVec = ((PyArrayObject *)__pyx_t_4);
 
3607
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3608
 
 
3609
  /* "pandas/lib/src/tseries.pyx":423
 
3610
 * 
 
3611
 *     # Get reference to the arrays inside
 
3612
 *     fillLocs = <int *> fillVec.data             # <<<<<<<<<<<<<<
 
3613
 *     mask = <char *> maskVec.data
 
3614
 * 
 
3615
 */
 
3616
  __pyx_v_fillLocs = ((int *)__pyx_v_fillVec->data);
 
3617
 
 
3618
  /* "pandas/lib/src/tseries.pyx":424
 
3619
 *     # Get reference to the arrays inside
 
3620
 *     fillLocs = <int *> fillVec.data
 
3621
 *     mask = <char *> maskVec.data             # <<<<<<<<<<<<<<
 
3622
 * 
 
3623
 *     # Create simple ndarray iterators using C API
 
3624
 */
 
3625
  __pyx_v_mask = ((char *)__pyx_v_maskVec->data);
 
3626
 
 
3627
  /* "pandas/lib/src/tseries.pyx":427
 
3628
 * 
 
3629
 *     # Create simple ndarray iterators using C API
 
3630
 *     iterold = PyArray_IterNew(oldIndex)             # <<<<<<<<<<<<<<
 
3631
 *     iternew = PyArray_IterNew(newIndex)
 
3632
 * 
 
3633
 */
 
3634
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_oldIndex)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3635
  __Pyx_GOTREF(__pyx_t_4);
 
3636
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3637
  __Pyx_DECREF(((PyObject *)__pyx_v_iterold));
 
3638
  __pyx_v_iterold = ((PyArrayIterObject *)__pyx_t_4);
 
3639
  __pyx_t_4 = 0;
 
3640
 
 
3641
  /* "pandas/lib/src/tseries.pyx":428
 
3642
 *     # Create simple ndarray iterators using C API
 
3643
 *     iterold = PyArray_IterNew(oldIndex)
 
3644
 *     iternew = PyArray_IterNew(newIndex)             # <<<<<<<<<<<<<<
 
3645
 * 
 
3646
 *     # Length of each index
 
3647
 */
 
3648
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_newIndex)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3649
  __Pyx_GOTREF(__pyx_t_4);
 
3650
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3651
  __Pyx_DECREF(((PyObject *)__pyx_v_iternew));
 
3652
  __pyx_v_iternew = ((PyArrayIterObject *)__pyx_t_4);
 
3653
  __pyx_t_4 = 0;
 
3654
 
 
3655
  /* "pandas/lib/src/tseries.pyx":431
 
3656
 * 
 
3657
 *     # Length of each index
 
3658
 *     oldLength = PyArray_SIZE(oldIndex)             # <<<<<<<<<<<<<<
 
3659
 *     newLength = PyArray_SIZE(newIndex)
 
3660
 * 
 
3661
 */
 
3662
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_oldIndex), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3663
  __pyx_v_oldLength = PyArray_SIZE(((PyArrayObject *)__pyx_v_oldIndex));
 
3664
 
 
3665
  /* "pandas/lib/src/tseries.pyx":432
 
3666
 *     # Length of each index
 
3667
 *     oldLength = PyArray_SIZE(oldIndex)
 
3668
 *     newLength = PyArray_SIZE(newIndex)             # <<<<<<<<<<<<<<
 
3669
 * 
 
3670
 *     oldPos = 0
 
3671
 */
 
3672
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_newIndex), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3673
  __pyx_v_newLength = PyArray_SIZE(((PyArrayObject *)__pyx_v_newIndex));
 
3674
 
 
3675
  /* "pandas/lib/src/tseries.pyx":434
 
3676
 *     newLength = PyArray_SIZE(newIndex)
 
3677
 * 
 
3678
 *     oldPos = 0             # <<<<<<<<<<<<<<
 
3679
 *     newPos = 0
 
3680
 *     while newPos < newLength:
 
3681
 */
 
3682
  __pyx_v_oldPos = 0;
 
3683
 
 
3684
  /* "pandas/lib/src/tseries.pyx":435
 
3685
 * 
 
3686
 *     oldPos = 0
 
3687
 *     newPos = 0             # <<<<<<<<<<<<<<
 
3688
 *     while newPos < newLength:
 
3689
 *         curOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)
 
3690
 */
 
3691
  __pyx_v_newPos = 0;
 
3692
 
 
3693
  /* "pandas/lib/src/tseries.pyx":436
 
3694
 *     oldPos = 0
 
3695
 *     newPos = 0
 
3696
 *     while newPos < newLength:             # <<<<<<<<<<<<<<
 
3697
 *         curOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)
 
3698
 * 
 
3699
 */
 
3700
  while (1) {
 
3701
    __pyx_t_5 = (__pyx_v_newPos < __pyx_v_newLength);
 
3702
    if (!__pyx_t_5) break;
 
3703
 
 
3704
    /* "pandas/lib/src/tseries.pyx":437
 
3705
 *     newPos = 0
 
3706
 *     while newPos < newLength:
 
3707
 *         curOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)             # <<<<<<<<<<<<<<
 
3708
 * 
 
3709
 *         # At beginning, keep going until we go exceed the
 
3710
 */
 
3711
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_oldIndex), ((void *)__pyx_v_iterold->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3712
    __Pyx_GOTREF(__pyx_t_4);
 
3713
    __Pyx_DECREF(__pyx_v_curOld);
 
3714
    __pyx_v_curOld = __pyx_t_4;
 
3715
    __pyx_t_4 = 0;
 
3716
 
 
3717
    /* "pandas/lib/src/tseries.pyx":441
 
3718
 *         # At beginning, keep going until we go exceed the
 
3719
 *         # first OLD index in the NEW index
 
3720
 *         while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) < curOld:             # <<<<<<<<<<<<<<
 
3721
 *             newPos += 1
 
3722
 *             if newPos > newLength - 1:
 
3723
 */
 
3724
    while (1) {
 
3725
      __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_newIndex), ((void *)__pyx_v_iternew->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3726
      __Pyx_GOTREF(__pyx_t_4);
 
3727
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_curOld, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3728
      __Pyx_GOTREF(__pyx_t_1);
 
3729
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3730
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3731
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3732
      if (!__pyx_t_5) break;
 
3733
 
 
3734
      /* "pandas/lib/src/tseries.pyx":442
 
3735
 *         # first OLD index in the NEW index
 
3736
 *         while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) < curOld:
 
3737
 *             newPos += 1             # <<<<<<<<<<<<<<
 
3738
 *             if newPos > newLength - 1:
 
3739
 *                 break
 
3740
 */
 
3741
      __pyx_v_newPos += 1;
 
3742
 
 
3743
      /* "pandas/lib/src/tseries.pyx":443
 
3744
 *         while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) < curOld:
 
3745
 *             newPos += 1
 
3746
 *             if newPos > newLength - 1:             # <<<<<<<<<<<<<<
 
3747
 *                 break
 
3748
 *             PyArray_ITER_NEXT(iternew)
 
3749
 */
 
3750
      __pyx_t_5 = (__pyx_v_newPos > (__pyx_v_newLength - 1));
 
3751
      if (__pyx_t_5) {
 
3752
 
 
3753
        /* "pandas/lib/src/tseries.pyx":444
 
3754
 *             newPos += 1
 
3755
 *             if newPos > newLength - 1:
 
3756
 *                 break             # <<<<<<<<<<<<<<
 
3757
 *             PyArray_ITER_NEXT(iternew)
 
3758
 * 
 
3759
 */
 
3760
        goto __pyx_L6_break;
 
3761
        goto __pyx_L7;
 
3762
      }
 
3763
      __pyx_L7:;
 
3764
 
 
3765
      /* "pandas/lib/src/tseries.pyx":445
 
3766
 *             if newPos > newLength - 1:
 
3767
 *                 break
 
3768
 *             PyArray_ITER_NEXT(iternew)             # <<<<<<<<<<<<<<
 
3769
 * 
 
3770
 *         # We got there, get the current location in the old index
 
3771
 */
 
3772
      PyArray_ITER_NEXT(__pyx_v_iternew);
 
3773
    }
 
3774
    __pyx_L6_break:;
 
3775
 
 
3776
    /* "pandas/lib/src/tseries.pyx":448
 
3777
 * 
 
3778
 *         # We got there, get the current location in the old index
 
3779
 *         curLoc = oldMap[curOld]             # <<<<<<<<<<<<<<
 
3780
 * 
 
3781
 *         # We're at the end of the road, need to propagate this value to the end
 
3782
 */
 
3783
    __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_curOld); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3784
    __Pyx_GOTREF(__pyx_2);
 
3785
    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3786
    __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
3787
    __pyx_v_curLoc = __pyx_t_6;
 
3788
 
 
3789
    /* "pandas/lib/src/tseries.pyx":451
 
3790
 * 
 
3791
 *         # We're at the end of the road, need to propagate this value to the end
 
3792
 *         if oldPos == oldLength - 1:             # <<<<<<<<<<<<<<
 
3793
 *             if PyArray_GETITEM(newIndex, <void *> iternew.dataptr) >= curOld:
 
3794
 *                 fillVec[newPos:] = curLoc
 
3795
 */
 
3796
    __pyx_t_5 = (__pyx_v_oldPos == (__pyx_v_oldLength - 1));
 
3797
    if (__pyx_t_5) {
 
3798
 
 
3799
      /* "pandas/lib/src/tseries.pyx":452
 
3800
 *         # We're at the end of the road, need to propagate this value to the end
 
3801
 *         if oldPos == oldLength - 1:
 
3802
 *             if PyArray_GETITEM(newIndex, <void *> iternew.dataptr) >= curOld:             # <<<<<<<<<<<<<<
 
3803
 *                 fillVec[newPos:] = curLoc
 
3804
 *                 maskVec[newPos:] = 1
 
3805
 */
 
3806
      __pyx_t_1 = PyArray_GETITEM(((PyObject *)__pyx_v_newIndex), ((void *)__pyx_v_iternew->dataptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3807
      __Pyx_GOTREF(__pyx_t_1);
 
3808
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_curOld, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3809
      __Pyx_GOTREF(__pyx_t_4);
 
3810
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3811
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3812
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3813
      if (__pyx_t_5) {
 
3814
 
 
3815
        /* "pandas/lib/src/tseries.pyx":453
 
3816
 *         if oldPos == oldLength - 1:
 
3817
 *             if PyArray_GETITEM(newIndex, <void *> iternew.dataptr) >= curOld:
 
3818
 *                 fillVec[newPos:] = curLoc             # <<<<<<<<<<<<<<
 
3819
 *                 maskVec[newPos:] = 1
 
3820
 *             break
 
3821
 */
 
3822
        __pyx_t_4 = PyInt_FromLong(__pyx_v_curLoc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3823
        __Pyx_GOTREF(__pyx_t_4);
 
3824
        if (PySequence_SetSlice(((PyObject *)__pyx_v_fillVec), __pyx_v_newPos, PY_SSIZE_T_MAX, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3825
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3826
 
 
3827
        /* "pandas/lib/src/tseries.pyx":454
 
3828
 *             if PyArray_GETITEM(newIndex, <void *> iternew.dataptr) >= curOld:
 
3829
 *                 fillVec[newPos:] = curLoc
 
3830
 *                 maskVec[newPos:] = 1             # <<<<<<<<<<<<<<
 
3831
 *             break
 
3832
 *         else:
 
3833
 */
 
3834
        if (PySequence_SetSlice(((PyObject *)__pyx_v_maskVec), __pyx_v_newPos, PY_SSIZE_T_MAX, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3835
        goto __pyx_L9;
 
3836
      }
 
3837
      __pyx_L9:;
 
3838
 
 
3839
      /* "pandas/lib/src/tseries.pyx":455
 
3840
 *                 fillVec[newPos:] = curLoc
 
3841
 *                 maskVec[newPos:] = 1
 
3842
 *             break             # <<<<<<<<<<<<<<
 
3843
 *         else:
 
3844
 *             # Not at the end, need to go about filling
 
3845
 */
 
3846
      goto __pyx_L4_break;
 
3847
      goto __pyx_L8;
 
3848
    }
 
3849
    /*else*/ {
 
3850
 
 
3851
      /* "pandas/lib/src/tseries.pyx":460
 
3852
 * 
 
3853
 *             # Get the next index so we know when to stop propagating this value
 
3854
 *             PyArray_ITER_NEXT(iterold)             # <<<<<<<<<<<<<<
 
3855
 *             nextOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)
 
3856
 * 
 
3857
 */
 
3858
      PyArray_ITER_NEXT(__pyx_v_iterold);
 
3859
 
 
3860
      /* "pandas/lib/src/tseries.pyx":461
 
3861
 *             # Get the next index so we know when to stop propagating this value
 
3862
 *             PyArray_ITER_NEXT(iterold)
 
3863
 *             nextOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)             # <<<<<<<<<<<<<<
 
3864
 * 
 
3865
 *             done = 0
 
3866
 */
 
3867
      __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_oldIndex), ((void *)__pyx_v_iterold->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3868
      __Pyx_GOTREF(__pyx_t_4);
 
3869
      __Pyx_DECREF(__pyx_v_nextOld);
 
3870
      __pyx_v_nextOld = __pyx_t_4;
 
3871
      __pyx_t_4 = 0;
 
3872
 
 
3873
      /* "pandas/lib/src/tseries.pyx":463
 
3874
 *             nextOld = PyArray_GETITEM(oldIndex, <void *> iterold.dataptr)
 
3875
 * 
 
3876
 *             done = 0             # <<<<<<<<<<<<<<
 
3877
 * 
 
3878
 *             # Until we reach the next OLD value in the NEW index
 
3879
 */
 
3880
      __pyx_v_done = 0;
 
3881
 
 
3882
      /* "pandas/lib/src/tseries.pyx":466
 
3883
 * 
 
3884
 *             # Until we reach the next OLD value in the NEW index
 
3885
 *             while PyArray_GETITEM(newIndex, <void *> iternew.dataptr) < nextOld:             # <<<<<<<<<<<<<<
 
3886
 * 
 
3887
 *                 # Use this location to fill
 
3888
 */
 
3889
      while (1) {
 
3890
        __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_newIndex), ((void *)__pyx_v_iternew->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3891
        __Pyx_GOTREF(__pyx_t_4);
 
3892
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_nextOld, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3893
        __Pyx_GOTREF(__pyx_t_1);
 
3894
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3895
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3896
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3897
        if (!__pyx_t_5) break;
 
3898
 
 
3899
        /* "pandas/lib/src/tseries.pyx":469
 
3900
 * 
 
3901
 *                 # Use this location to fill
 
3902
 *                 fillLocs[newPos] = curLoc             # <<<<<<<<<<<<<<
 
3903
 * 
 
3904
 *                 # Set mask to be 1 so will not be NaN'd
 
3905
 */
 
3906
        (__pyx_v_fillLocs[__pyx_v_newPos]) = __pyx_v_curLoc;
 
3907
 
 
3908
        /* "pandas/lib/src/tseries.pyx":472
 
3909
 * 
 
3910
 *                 # Set mask to be 1 so will not be NaN'd
 
3911
 *                 mask[newPos] = 1             # <<<<<<<<<<<<<<
 
3912
 *                 newPos += 1
 
3913
 * 
 
3914
 */
 
3915
        (__pyx_v_mask[__pyx_v_newPos]) = 1;
 
3916
 
 
3917
        /* "pandas/lib/src/tseries.pyx":473
 
3918
 *                 # Set mask to be 1 so will not be NaN'd
 
3919
 *                 mask[newPos] = 1
 
3920
 *                 newPos += 1             # <<<<<<<<<<<<<<
 
3921
 * 
 
3922
 *                 # We got to the end of the new index
 
3923
 */
 
3924
        __pyx_v_newPos += 1;
 
3925
 
 
3926
        /* "pandas/lib/src/tseries.pyx":476
 
3927
 * 
 
3928
 *                 # We got to the end of the new index
 
3929
 *                 if newPos > newLength - 1:             # <<<<<<<<<<<<<<
 
3930
 *                     done = 1
 
3931
 *                     break
 
3932
 */
 
3933
        __pyx_t_5 = (__pyx_v_newPos > (__pyx_v_newLength - 1));
 
3934
        if (__pyx_t_5) {
 
3935
 
 
3936
          /* "pandas/lib/src/tseries.pyx":477
 
3937
 *                 # We got to the end of the new index
 
3938
 *                 if newPos > newLength - 1:
 
3939
 *                     done = 1             # <<<<<<<<<<<<<<
 
3940
 *                     break
 
3941
 * 
 
3942
 */
 
3943
          __pyx_v_done = 1;
 
3944
 
 
3945
          /* "pandas/lib/src/tseries.pyx":478
 
3946
 *                 if newPos > newLength - 1:
 
3947
 *                     done = 1
 
3948
 *                     break             # <<<<<<<<<<<<<<
 
3949
 * 
 
3950
 *                 # Advance the pointer
 
3951
 */
 
3952
          goto __pyx_L11_break;
 
3953
          goto __pyx_L12;
 
3954
        }
 
3955
        __pyx_L12:;
 
3956
 
 
3957
        /* "pandas/lib/src/tseries.pyx":481
 
3958
 * 
 
3959
 *                 # Advance the pointer
 
3960
 *                 PyArray_ITER_NEXT(iternew)             # <<<<<<<<<<<<<<
 
3961
 * 
 
3962
 *             # We got to the end of the new index
 
3963
 */
 
3964
        PyArray_ITER_NEXT(__pyx_v_iternew);
 
3965
      }
 
3966
      __pyx_L11_break:;
 
3967
 
 
3968
      /* "pandas/lib/src/tseries.pyx":484
 
3969
 * 
 
3970
 *             # We got to the end of the new index
 
3971
 *             if done:             # <<<<<<<<<<<<<<
 
3972
 *                 break
 
3973
 * 
 
3974
 */
 
3975
      __pyx_t_7 = __pyx_v_done;
 
3976
      if (__pyx_t_7) {
 
3977
 
 
3978
        /* "pandas/lib/src/tseries.pyx":485
 
3979
 *             # We got to the end of the new index
 
3980
 *             if done:
 
3981
 *                 break             # <<<<<<<<<<<<<<
 
3982
 * 
 
3983
 *         # We already advanced the iterold pointer to the next value,
 
3984
 */
 
3985
        goto __pyx_L4_break;
 
3986
        goto __pyx_L13;
 
3987
      }
 
3988
      __pyx_L13:;
 
3989
    }
 
3990
    __pyx_L8:;
 
3991
 
 
3992
    /* "pandas/lib/src/tseries.pyx":489
 
3993
 *         # We already advanced the iterold pointer to the next value,
 
3994
 *         # inc the count
 
3995
 *         oldPos += 1             # <<<<<<<<<<<<<<
 
3996
 * 
 
3997
 *     # Places where the mask is 0, fill with an arbitrary value
 
3998
 */
 
3999
    __pyx_v_oldPos += 1;
 
4000
  }
 
4001
  __pyx_L4_break:;
 
4002
 
 
4003
  /* "pandas/lib/src/tseries.pyx":493
 
4004
 *     # Places where the mask is 0, fill with an arbitrary value
 
4005
 *     # (will be NA'd out)
 
4006
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 
4007
 *         if mask[i] == 0:
 
4008
 *             fillLocs[i] = -1
 
4009
 */
 
4010
  __pyx_t_6 = __pyx_v_newLength;
 
4011
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
 
4012
 
 
4013
    /* "pandas/lib/src/tseries.pyx":494
 
4014
 *     # (will be NA'd out)
 
4015
 *     for i from 0 <= i < newLength:
 
4016
 *         if mask[i] == 0:             # <<<<<<<<<<<<<<
 
4017
 *             fillLocs[i] = -1
 
4018
 * 
 
4019
 */
 
4020
    __pyx_t_5 = ((__pyx_v_mask[__pyx_v_i]) == 0);
 
4021
    if (__pyx_t_5) {
 
4022
 
 
4023
      /* "pandas/lib/src/tseries.pyx":495
 
4024
 *     for i from 0 <= i < newLength:
 
4025
 *         if mask[i] == 0:
 
4026
 *             fillLocs[i] = -1             # <<<<<<<<<<<<<<
 
4027
 * 
 
4028
 *     return fillVec, maskVec
 
4029
 */
 
4030
      (__pyx_v_fillLocs[__pyx_v_i]) = -1;
 
4031
      goto __pyx_L16;
 
4032
    }
 
4033
    __pyx_L16:;
 
4034
  }
 
4035
 
 
4036
  /* "pandas/lib/src/tseries.pyx":497
 
4037
 *             fillLocs[i] = -1
 
4038
 * 
 
4039
 *     return fillVec, maskVec             # <<<<<<<<<<<<<<
 
4040
 * 
 
4041
 * def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap,
 
4042
 */
 
4043
  __Pyx_XDECREF(((PyObject *)__pyx_r));
 
4044
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4045
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
4046
  __Pyx_INCREF(((PyObject *)__pyx_v_fillVec));
 
4047
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fillVec));
 
4048
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec));
 
4049
  __Pyx_INCREF(((PyObject *)__pyx_v_maskVec));
 
4050
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_maskVec));
 
4051
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maskVec));
 
4052
  __pyx_r = __pyx_t_1;
 
4053
  __pyx_t_1 = 0;
 
4054
  goto __pyx_L0;
 
4055
 
 
4056
  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
4057
  goto __pyx_L0;
 
4058
  __pyx_L1_error:;
 
4059
  __Pyx_XDECREF(__pyx_1);
 
4060
  __Pyx_XDECREF(__pyx_2);
 
4061
  __Pyx_XDECREF(__pyx_t_1);
 
4062
  __Pyx_XDECREF(__pyx_t_3);
 
4063
  __Pyx_XDECREF(__pyx_t_4);
 
4064
  __Pyx_AddTraceback("tseries._pad");
 
4065
  __pyx_r = 0;
 
4066
  __pyx_L0:;
 
4067
  __Pyx_DECREF((PyObject *)__pyx_v_fillVec);
 
4068
  __Pyx_DECREF((PyObject *)__pyx_v_maskVec);
 
4069
  __Pyx_DECREF((PyObject *)__pyx_v_iterold);
 
4070
  __Pyx_DECREF((PyObject *)__pyx_v_iternew);
 
4071
  __Pyx_DECREF(__pyx_v_nextOld);
 
4072
  __Pyx_DECREF(__pyx_v_curOld);
 
4073
  __Pyx_XGIVEREF(__pyx_r);
 
4074
  __Pyx_FinishRefcountContext();
 
4075
  return __pyx_r;
 
4076
}
 
4077
 
 
4078
/* "pandas/lib/src/tseries.pyx":499
 
4079
 *     return fillVec, maskVec
 
4080
 * 
 
4081
 * def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap,             # <<<<<<<<<<<<<<
 
4082
 *                object kind):
 
4083
 * 
 
4084
 */
 
4085
 
 
4086
static PyObject *__pyx_pf_7tseries_getFillVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
4087
static PyObject *__pyx_pf_7tseries_getFillVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
4088
  PyArrayObject *__pyx_v_oldIndex = 0;
 
4089
  PyArrayObject *__pyx_v_newIndex = 0;
 
4090
  PyObject *__pyx_v_oldMap = 0;
 
4091
  PyObject *__pyx_v_newMap = 0;
 
4092
  PyObject *__pyx_v_kind = 0;
 
4093
  PyObject *__pyx_v_fillVec;
 
4094
  PyObject *__pyx_v_maskVec;
 
4095
  PyObject *__pyx_r = NULL;
 
4096
  PyObject *__pyx_1 = 0;
 
4097
  PyObject *__pyx_2 = 0;
 
4098
  PyObject *__pyx_3 = 0;
 
4099
  PyObject *__pyx_t_1 = NULL;
 
4100
  int __pyx_t_2;
 
4101
  PyObject *__pyx_t_3 = NULL;
 
4102
  PyObject *__pyx_t_4 = NULL;
 
4103
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_oldIndex,&__pyx_kp_newIndex,&__pyx_kp_oldMap,&__pyx_kp_newMap,&__pyx_kp_kind,0};
 
4104
  __Pyx_SetupRefcountContext("getFillVec");
 
4105
  __pyx_self = __pyx_self;
 
4106
  if (unlikely(__pyx_kwds)) {
 
4107
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
4108
    PyObject* values[5] = {0,0,0,0,0};
 
4109
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
4110
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
 
4111
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
 
4112
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
 
4113
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
4114
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
4115
      case  0: break;
 
4116
      default: goto __pyx_L5_argtuple_error;
 
4117
    }
 
4118
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
4119
      case  0:
 
4120
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_oldIndex);
 
4121
      if (likely(values[0])) kw_args--;
 
4122
      else goto __pyx_L5_argtuple_error;
 
4123
      case  1:
 
4124
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_newIndex);
 
4125
      if (likely(values[1])) kw_args--;
 
4126
      else {
 
4127
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4128
      }
 
4129
      case  2:
 
4130
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_oldMap);
 
4131
      if (likely(values[2])) kw_args--;
 
4132
      else {
 
4133
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4134
      }
 
4135
      case  3:
 
4136
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_newMap);
 
4137
      if (likely(values[3])) kw_args--;
 
4138
      else {
 
4139
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4140
      }
 
4141
      case  4:
 
4142
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_kind);
 
4143
      if (likely(values[4])) kw_args--;
 
4144
      else {
 
4145
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4146
      }
 
4147
    }
 
4148
    if (unlikely(kw_args > 0)) {
 
4149
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "getFillVec") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4150
    }
 
4151
    __pyx_v_oldIndex = ((PyArrayObject *)values[0]);
 
4152
    __pyx_v_newIndex = ((PyArrayObject *)values[1]);
 
4153
    __pyx_v_oldMap = ((PyObject *)values[2]);
 
4154
    __pyx_v_newMap = ((PyObject *)values[3]);
 
4155
    __pyx_v_kind = values[4];
 
4156
  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
 
4157
    goto __pyx_L5_argtuple_error;
 
4158
  } else {
 
4159
    __pyx_v_oldIndex = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
4160
    __pyx_v_newIndex = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
4161
    __pyx_v_oldMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
 
4162
    __pyx_v_newMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 3));
 
4163
    __pyx_v_kind = PyTuple_GET_ITEM(__pyx_args, 4);
 
4164
  }
 
4165
  goto __pyx_L4_argument_unpacking_done;
 
4166
  __pyx_L5_argtuple_error:;
 
4167
  __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4168
  __pyx_L3_error:;
 
4169
  __Pyx_AddTraceback("tseries.getFillVec");
 
4170
  return NULL;
 
4171
  __pyx_L4_argument_unpacking_done:;
 
4172
  __pyx_v_fillVec = Py_None; __Pyx_INCREF(Py_None);
 
4173
  __pyx_v_maskVec = Py_None; __Pyx_INCREF(Py_None);
 
4174
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldIndex), __pyx_ptype_5numpy_ndarray, 1, "oldIndex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4175
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newIndex), __pyx_ptype_5numpy_ndarray, 1, "newIndex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4176
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldMap), &PyDict_Type, 1, "oldMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4177
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newMap), &PyDict_Type, 1, "newMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4178
 
 
4179
  /* "pandas/lib/src/tseries.pyx":502
 
4180
 *                object kind):
 
4181
 * 
 
4182
 *     if kind == '':             # <<<<<<<<<<<<<<
 
4183
 *         fillVec, maskVec = _nofill(oldIndex, newIndex, oldMap, newMap)
 
4184
 *     elif kind == 'PAD':
 
4185
 */
 
4186
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_kind, __pyx_kp_35, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4187
  __Pyx_GOTREF(__pyx_t_1);
 
4188
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4189
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4190
  if (__pyx_t_2) {
 
4191
 
 
4192
    /* "pandas/lib/src/tseries.pyx":503
 
4193
 * 
 
4194
 *     if kind == '':
 
4195
 *         fillVec, maskVec = _nofill(oldIndex, newIndex, oldMap, newMap)             # <<<<<<<<<<<<<<
 
4196
 *     elif kind == 'PAD':
 
4197
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 
4198
 */
 
4199
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__nofill(__pyx_v_oldIndex, __pyx_v_newIndex, __pyx_v_oldMap, __pyx_v_newMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4200
    __Pyx_GOTREF(__pyx_t_1);
 
4201
    if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
 
4202
      PyObject* tuple = __pyx_t_1;
 
4203
      __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
 
4204
      __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
 
4205
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4206
      __Pyx_DECREF(__pyx_v_fillVec);
 
4207
      __pyx_v_fillVec = __pyx_2;
 
4208
      __pyx_2 = 0;
 
4209
      __Pyx_DECREF(__pyx_v_maskVec);
 
4210
      __pyx_v_maskVec = __pyx_3;
 
4211
      __pyx_3 = 0;
 
4212
    } else {
 
4213
      __Pyx_UnpackTupleError(__pyx_t_1, 2);
 
4214
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4215
    }
 
4216
    goto __pyx_L6;
 
4217
  }
 
4218
 
 
4219
  /* "pandas/lib/src/tseries.pyx":504
 
4220
 *     if kind == '':
 
4221
 *         fillVec, maskVec = _nofill(oldIndex, newIndex, oldMap, newMap)
 
4222
 *     elif kind == 'PAD':             # <<<<<<<<<<<<<<
 
4223
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 
4224
 *     elif kind == 'BACKFILL':
 
4225
 */
 
4226
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_kind, __pyx_kp_36, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4227
  __Pyx_GOTREF(__pyx_t_1);
 
4228
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4229
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4230
  if (__pyx_t_2) {
 
4231
 
 
4232
    /* "pandas/lib/src/tseries.pyx":505
 
4233
 *         fillVec, maskVec = _nofill(oldIndex, newIndex, oldMap, newMap)
 
4234
 *     elif kind == 'PAD':
 
4235
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)             # <<<<<<<<<<<<<<
 
4236
 *     elif kind == 'BACKFILL':
 
4237
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)
 
4238
 */
 
4239
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__pad(__pyx_v_oldIndex, __pyx_v_newIndex, __pyx_v_oldMap, __pyx_v_newMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4240
    __Pyx_GOTREF(__pyx_t_1);
 
4241
    if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
 
4242
      PyObject* tuple = __pyx_t_1;
 
4243
      __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
 
4244
      __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
 
4245
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4246
      __Pyx_DECREF(__pyx_v_fillVec);
 
4247
      __pyx_v_fillVec = __pyx_2;
 
4248
      __pyx_2 = 0;
 
4249
      __Pyx_DECREF(__pyx_v_maskVec);
 
4250
      __pyx_v_maskVec = __pyx_3;
 
4251
      __pyx_3 = 0;
 
4252
    } else {
 
4253
      __Pyx_UnpackTupleError(__pyx_t_1, 2);
 
4254
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4255
    }
 
4256
    goto __pyx_L6;
 
4257
  }
 
4258
 
 
4259
  /* "pandas/lib/src/tseries.pyx":506
 
4260
 *     elif kind == 'PAD':
 
4261
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 
4262
 *     elif kind == 'BACKFILL':             # <<<<<<<<<<<<<<
 
4263
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)
 
4264
 * 
 
4265
 */
 
4266
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_kind, __pyx_kp_37, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4267
  __Pyx_GOTREF(__pyx_t_1);
 
4268
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4269
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4270
  if (__pyx_t_2) {
 
4271
 
 
4272
    /* "pandas/lib/src/tseries.pyx":507
 
4273
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 
4274
 *     elif kind == 'BACKFILL':
 
4275
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)             # <<<<<<<<<<<<<<
 
4276
 * 
 
4277
 *     return fillVec, maskVec.astype(np.bool)
 
4278
 */
 
4279
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__backfill(__pyx_v_oldIndex, __pyx_v_newIndex, __pyx_v_oldMap, __pyx_v_newMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4280
    __Pyx_GOTREF(__pyx_t_1);
 
4281
    if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
 
4282
      PyObject* tuple = __pyx_t_1;
 
4283
      __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
 
4284
      __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
 
4285
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4286
      __Pyx_DECREF(__pyx_v_fillVec);
 
4287
      __pyx_v_fillVec = __pyx_2;
 
4288
      __pyx_2 = 0;
 
4289
      __Pyx_DECREF(__pyx_v_maskVec);
 
4290
      __pyx_v_maskVec = __pyx_3;
 
4291
      __pyx_3 = 0;
 
4292
    } else {
 
4293
      __Pyx_UnpackTupleError(__pyx_t_1, 2);
 
4294
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4295
    }
 
4296
    goto __pyx_L6;
 
4297
  }
 
4298
  __pyx_L6:;
 
4299
 
 
4300
  /* "pandas/lib/src/tseries.pyx":509
 
4301
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)
 
4302
 * 
 
4303
 *     return fillVec, maskVec.astype(np.bool)             # <<<<<<<<<<<<<<
 
4304
 * 
 
4305
 * def getMergeVec(ndarray values, dict indexMap):
 
4306
 */
 
4307
  __Pyx_XDECREF(__pyx_r);
 
4308
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_maskVec, __pyx_kp_astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4309
  __Pyx_GOTREF(__pyx_t_1);
 
4310
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4311
  __Pyx_GOTREF(__pyx_1);
 
4312
  __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_bool); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4313
  __Pyx_GOTREF(__pyx_t_3);
 
4314
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
4315
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4316
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
4317
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
 
4318
  __Pyx_GIVEREF(__pyx_t_3);
 
4319
  __pyx_t_3 = 0;
 
4320
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4321
  __Pyx_GOTREF(__pyx_t_3);
 
4322
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4323
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
4324
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4325
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
4326
  __Pyx_INCREF(__pyx_v_fillVec);
 
4327
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fillVec);
 
4328
  __Pyx_GIVEREF(__pyx_v_fillVec);
 
4329
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
 
4330
  __Pyx_GIVEREF(__pyx_t_3);
 
4331
  __pyx_t_3 = 0;
 
4332
  __pyx_r = ((PyObject *)__pyx_t_4);
 
4333
  __pyx_t_4 = 0;
 
4334
  goto __pyx_L0;
 
4335
 
 
4336
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
4337
  goto __pyx_L0;
 
4338
  __pyx_L1_error:;
 
4339
  __Pyx_XDECREF(__pyx_1);
 
4340
  __Pyx_XDECREF(__pyx_2);
 
4341
  __Pyx_XDECREF(__pyx_3);
 
4342
  __Pyx_XDECREF(__pyx_t_1);
 
4343
  __Pyx_XDECREF(__pyx_t_3);
 
4344
  __Pyx_XDECREF(__pyx_t_4);
 
4345
  __Pyx_AddTraceback("tseries.getFillVec");
 
4346
  __pyx_r = NULL;
 
4347
  __pyx_L0:;
 
4348
  __Pyx_DECREF(__pyx_v_fillVec);
 
4349
  __Pyx_DECREF(__pyx_v_maskVec);
 
4350
  __Pyx_XGIVEREF(__pyx_r);
 
4351
  __Pyx_FinishRefcountContext();
 
4352
  return __pyx_r;
 
4353
}
 
4354
 
 
4355
/* "pandas/lib/src/tseries.pyx":511
 
4356
 *     return fillVec, maskVec.astype(np.bool)
 
4357
 * 
 
4358
 * def getMergeVec(ndarray values, dict indexMap):             # <<<<<<<<<<<<<<
 
4359
 *     cdef int *fillLocs
 
4360
 *     cdef char *mask
 
4361
 */
 
4362
 
 
4363
static PyObject *__pyx_pf_7tseries_getMergeVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
4364
static PyObject *__pyx_pf_7tseries_getMergeVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
4365
  PyArrayObject *__pyx_v_values = 0;
 
4366
  PyObject *__pyx_v_indexMap = 0;
 
4367
  int *__pyx_v_fillLocs;
 
4368
  char *__pyx_v_mask;
 
4369
  int __pyx_v_i;
 
4370
  int __pyx_v_j;
 
4371
  int __pyx_v_length;
 
4372
  PyArrayIterObject *__pyx_v_itervals;
 
4373
  PyObject *__pyx_v_val;
 
4374
  PyArrayObject *__pyx_v_fillVec;
 
4375
  PyArrayObject *__pyx_v_maskVec;
 
4376
  int __pyx_v_newLength;
 
4377
  PyObject *__pyx_r = NULL;
 
4378
  PyObject *__pyx_1 = 0;
 
4379
  PyObject *__pyx_2 = 0;
 
4380
  Py_ssize_t __pyx_t_1;
 
4381
  PyObject *__pyx_t_2 = NULL;
 
4382
  PyObject *__pyx_t_3 = NULL;
 
4383
  PyObject *__pyx_t_4 = NULL;
 
4384
  int __pyx_t_5;
 
4385
  int __pyx_t_6;
 
4386
  int __pyx_t_7;
 
4387
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_values,&__pyx_kp_indexMap,0};
 
4388
  __Pyx_SetupRefcountContext("getMergeVec");
 
4389
  __pyx_self = __pyx_self;
 
4390
  if (unlikely(__pyx_kwds)) {
 
4391
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
4392
    PyObject* values[2] = {0,0};
 
4393
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
4394
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
4395
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
4396
      case  0: break;
 
4397
      default: goto __pyx_L5_argtuple_error;
 
4398
    }
 
4399
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
4400
      case  0:
 
4401
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_values);
 
4402
      if (likely(values[0])) kw_args--;
 
4403
      else goto __pyx_L5_argtuple_error;
 
4404
      case  1:
 
4405
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_indexMap);
 
4406
      if (likely(values[1])) kw_args--;
 
4407
      else {
 
4408
        __Pyx_RaiseArgtupleInvalid("getMergeVec", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4409
      }
 
4410
    }
 
4411
    if (unlikely(kw_args > 0)) {
 
4412
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "getMergeVec") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4413
    }
 
4414
    __pyx_v_values = ((PyArrayObject *)values[0]);
 
4415
    __pyx_v_indexMap = ((PyObject *)values[1]);
 
4416
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
 
4417
    goto __pyx_L5_argtuple_error;
 
4418
  } else {
 
4419
    __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
4420
    __pyx_v_indexMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
4421
  }
 
4422
  goto __pyx_L4_argument_unpacking_done;
 
4423
  __pyx_L5_argtuple_error:;
 
4424
  __Pyx_RaiseArgtupleInvalid("getMergeVec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
4425
  __pyx_L3_error:;
 
4426
  __Pyx_AddTraceback("tseries.getMergeVec");
 
4427
  return NULL;
 
4428
  __pyx_L4_argument_unpacking_done:;
 
4429
  __pyx_v_itervals = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
4430
  __pyx_v_val = Py_None; __Pyx_INCREF(Py_None);
 
4431
  __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
4432
  __pyx_v_maskVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
4433
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4434
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexMap), &PyDict_Type, 1, "indexMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4435
 
 
4436
  /* "pandas/lib/src/tseries.pyx":521
 
4437
 *     cdef ndarray maskVec
 
4438
 * 
 
4439
 *     cdef int newLength = len(values)             # <<<<<<<<<<<<<<
 
4440
 * 
 
4441
 *     fillVec = <ndarray> np.empty(newLength, dtype = np.int32)
 
4442
 */
 
4443
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4444
  __pyx_v_newLength = __pyx_t_1;
 
4445
 
 
4446
  /* "pandas/lib/src/tseries.pyx":523
 
4447
 *     cdef int newLength = len(values)
 
4448
 * 
 
4449
 *     fillVec = <ndarray> np.empty(newLength, dtype = np.int32)             # <<<<<<<<<<<<<<
 
4450
 *     maskVec = <ndarray> np.zeros(newLength, dtype = np.int8)
 
4451
 * 
 
4452
 */
 
4453
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4454
  __Pyx_GOTREF(__pyx_1);
 
4455
  __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4456
  __Pyx_GOTREF(__pyx_t_2);
 
4457
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
4458
  __pyx_t_3 = PyInt_FromLong(__pyx_v_newLength); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4459
  __Pyx_GOTREF(__pyx_t_3);
 
4460
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4461
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
4462
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
 
4463
  __Pyx_GIVEREF(__pyx_t_3);
 
4464
  __pyx_t_3 = 0;
 
4465
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4466
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
4467
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4468
  __Pyx_GOTREF(__pyx_2);
 
4469
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_33); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4470
  __Pyx_GOTREF(__pyx_t_3);
 
4471
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
4472
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4473
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4474
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4475
  __Pyx_GOTREF(__pyx_t_3);
 
4476
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4477
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
4478
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
4479
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
 
4480
  __Pyx_DECREF(((PyObject *)__pyx_v_fillVec));
 
4481
  __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_3);
 
4482
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4483
 
 
4484
  /* "pandas/lib/src/tseries.pyx":524
 
4485
 * 
 
4486
 *     fillVec = <ndarray> np.empty(newLength, dtype = np.int32)
 
4487
 *     maskVec = <ndarray> np.zeros(newLength, dtype = np.int8)             # <<<<<<<<<<<<<<
 
4488
 * 
 
4489
 *     fillLocs = <int *> fillVec.data
 
4490
 */
 
4491
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4492
  __Pyx_GOTREF(__pyx_2);
 
4493
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4494
  __Pyx_GOTREF(__pyx_t_3);
 
4495
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
4496
  __pyx_t_4 = PyInt_FromLong(__pyx_v_newLength); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4497
  __Pyx_GOTREF(__pyx_t_4);
 
4498
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4499
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
4500
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
 
4501
  __Pyx_GIVEREF(__pyx_t_4);
 
4502
  __pyx_t_4 = 0;
 
4503
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4504
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
4505
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4506
  __Pyx_GOTREF(__pyx_2);
 
4507
  __pyx_t_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_34); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4508
  __Pyx_GOTREF(__pyx_t_4);
 
4509
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
4510
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4511
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
4512
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4513
  __Pyx_GOTREF(__pyx_t_4);
 
4514
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4515
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
4516
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
4517
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
4518
  __Pyx_DECREF(((PyObject *)__pyx_v_maskVec));
 
4519
  __pyx_v_maskVec = ((PyArrayObject *)__pyx_t_4);
 
4520
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
4521
 
 
4522
  /* "pandas/lib/src/tseries.pyx":526
 
4523
 *     maskVec = <ndarray> np.zeros(newLength, dtype = np.int8)
 
4524
 * 
 
4525
 *     fillLocs = <int *> fillVec.data             # <<<<<<<<<<<<<<
 
4526
 *     mask = <char *> maskVec.data
 
4527
 * 
 
4528
 */
 
4529
  __pyx_v_fillLocs = ((int *)__pyx_v_fillVec->data);
 
4530
 
 
4531
  /* "pandas/lib/src/tseries.pyx":527
 
4532
 * 
 
4533
 *     fillLocs = <int *> fillVec.data
 
4534
 *     mask = <char *> maskVec.data             # <<<<<<<<<<<<<<
 
4535
 * 
 
4536
 *     length = PyArray_SIZE(values)
 
4537
 */
 
4538
  __pyx_v_mask = ((char *)__pyx_v_maskVec->data);
 
4539
 
 
4540
  /* "pandas/lib/src/tseries.pyx":529
 
4541
 *     mask = <char *> maskVec.data
 
4542
 * 
 
4543
 *     length = PyArray_SIZE(values)             # <<<<<<<<<<<<<<
 
4544
 *     itervals = PyArray_IterNew(values)
 
4545
 * 
 
4546
 */
 
4547
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4548
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_values));
 
4549
 
 
4550
  /* "pandas/lib/src/tseries.pyx":530
 
4551
 * 
 
4552
 *     length = PyArray_SIZE(values)
 
4553
 *     itervals = PyArray_IterNew(values)             # <<<<<<<<<<<<<<
 
4554
 * 
 
4555
 *     for i from 0 <= i < length:
 
4556
 */
 
4557
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_values)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4558
  __Pyx_GOTREF(__pyx_t_4);
 
4559
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4560
  __Pyx_DECREF(((PyObject *)__pyx_v_itervals));
 
4561
  __pyx_v_itervals = ((PyArrayIterObject *)__pyx_t_4);
 
4562
  __pyx_t_4 = 0;
 
4563
 
 
4564
  /* "pandas/lib/src/tseries.pyx":532
 
4565
 *     itervals = PyArray_IterNew(values)
 
4566
 * 
 
4567
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
4568
 *         val = PyArray_GETITEM(values, <void *> itervals.dataptr)
 
4569
 *         if val in indexMap:
 
4570
 */
 
4571
  __pyx_t_5 = __pyx_v_length;
 
4572
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
4573
 
 
4574
    /* "pandas/lib/src/tseries.pyx":533
 
4575
 * 
 
4576
 *     for i from 0 <= i < length:
 
4577
 *         val = PyArray_GETITEM(values, <void *> itervals.dataptr)             # <<<<<<<<<<<<<<
 
4578
 *         if val in indexMap:
 
4579
 *             j = indexMap[val]
 
4580
 */
 
4581
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_values), ((void *)__pyx_v_itervals->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4582
    __Pyx_GOTREF(__pyx_t_4);
 
4583
    __Pyx_DECREF(__pyx_v_val);
 
4584
    __pyx_v_val = __pyx_t_4;
 
4585
    __pyx_t_4 = 0;
 
4586
 
 
4587
    /* "pandas/lib/src/tseries.pyx":534
 
4588
 *     for i from 0 <= i < length:
 
4589
 *         val = PyArray_GETITEM(values, <void *> itervals.dataptr)
 
4590
 *         if val in indexMap:             # <<<<<<<<<<<<<<
 
4591
 *             j = indexMap[val]
 
4592
 *             fillLocs[i] = j
 
4593
 */
 
4594
    __pyx_t_6 = (PySequence_Contains(((PyObject *)__pyx_v_indexMap), __pyx_v_val)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4595
    if (__pyx_t_6) {
 
4596
 
 
4597
      /* "pandas/lib/src/tseries.pyx":535
 
4598
 *         val = PyArray_GETITEM(values, <void *> itervals.dataptr)
 
4599
 *         if val in indexMap:
 
4600
 *             j = indexMap[val]             # <<<<<<<<<<<<<<
 
4601
 *             fillLocs[i] = j
 
4602
 *             mask[i] = 1
 
4603
 */
 
4604
      __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_indexMap), __pyx_v_val); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4605
      __Pyx_GOTREF(__pyx_2);
 
4606
      __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4607
      __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
4608
      __pyx_v_j = __pyx_t_7;
 
4609
 
 
4610
      /* "pandas/lib/src/tseries.pyx":536
 
4611
 *         if val in indexMap:
 
4612
 *             j = indexMap[val]
 
4613
 *             fillLocs[i] = j             # <<<<<<<<<<<<<<
 
4614
 *             mask[i] = 1
 
4615
 * 
 
4616
 */
 
4617
      (__pyx_v_fillLocs[__pyx_v_i]) = __pyx_v_j;
 
4618
 
 
4619
      /* "pandas/lib/src/tseries.pyx":537
 
4620
 *             j = indexMap[val]
 
4621
 *             fillLocs[i] = j
 
4622
 *             mask[i] = 1             # <<<<<<<<<<<<<<
 
4623
 * 
 
4624
 *         PyArray_ITER_NEXT(itervals)
 
4625
 */
 
4626
      (__pyx_v_mask[__pyx_v_i]) = 1;
 
4627
      goto __pyx_L8;
 
4628
    }
 
4629
    __pyx_L8:;
 
4630
 
 
4631
    /* "pandas/lib/src/tseries.pyx":539
 
4632
 *             mask[i] = 1
 
4633
 * 
 
4634
 *         PyArray_ITER_NEXT(itervals)             # <<<<<<<<<<<<<<
 
4635
 * 
 
4636
 *     for i from 0 <= i < newLength:
 
4637
 */
 
4638
    PyArray_ITER_NEXT(__pyx_v_itervals);
 
4639
  }
 
4640
 
 
4641
  /* "pandas/lib/src/tseries.pyx":541
 
4642
 *         PyArray_ITER_NEXT(itervals)
 
4643
 * 
 
4644
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 
4645
 *         if mask[i] == 0:
 
4646
 *             fillLocs[i] = -1
 
4647
 */
 
4648
  __pyx_t_5 = __pyx_v_newLength;
 
4649
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
4650
 
 
4651
    /* "pandas/lib/src/tseries.pyx":542
 
4652
 * 
 
4653
 *     for i from 0 <= i < newLength:
 
4654
 *         if mask[i] == 0:             # <<<<<<<<<<<<<<
 
4655
 *             fillLocs[i] = -1
 
4656
 * 
 
4657
 */
 
4658
    __pyx_t_6 = ((__pyx_v_mask[__pyx_v_i]) == 0);
 
4659
    if (__pyx_t_6) {
 
4660
 
 
4661
      /* "pandas/lib/src/tseries.pyx":543
 
4662
 *     for i from 0 <= i < newLength:
 
4663
 *         if mask[i] == 0:
 
4664
 *             fillLocs[i] = -1             # <<<<<<<<<<<<<<
 
4665
 * 
 
4666
 *     return fillVec, maskVec.astype(np.bool)
 
4667
 */
 
4668
      (__pyx_v_fillLocs[__pyx_v_i]) = -1;
 
4669
      goto __pyx_L11;
 
4670
    }
 
4671
    __pyx_L11:;
 
4672
  }
 
4673
 
 
4674
  /* "pandas/lib/src/tseries.pyx":545
 
4675
 *             fillLocs[i] = -1
 
4676
 * 
 
4677
 *     return fillVec, maskVec.astype(np.bool)             # <<<<<<<<<<<<<<
 
4678
 * 
 
4679
 * cdef double INF = <double> np.inf
 
4680
 */
 
4681
  __Pyx_XDECREF(__pyx_r);
 
4682
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_maskVec), __pyx_kp_astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4683
  __Pyx_GOTREF(__pyx_t_4);
 
4684
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4685
  __Pyx_GOTREF(__pyx_1);
 
4686
  __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4687
  __Pyx_GOTREF(__pyx_t_2);
 
4688
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
4689
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4690
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
4691
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
 
4692
  __Pyx_GIVEREF(__pyx_t_2);
 
4693
  __pyx_t_2 = 0;
 
4694
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4695
  __Pyx_GOTREF(__pyx_t_2);
 
4696
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
4697
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
4698
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4699
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
4700
  __Pyx_INCREF(((PyObject *)__pyx_v_fillVec));
 
4701
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_fillVec));
 
4702
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec));
 
4703
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
 
4704
  __Pyx_GIVEREF(__pyx_t_2);
 
4705
  __pyx_t_2 = 0;
 
4706
  __pyx_r = ((PyObject *)__pyx_t_3);
 
4707
  __pyx_t_3 = 0;
 
4708
  goto __pyx_L0;
 
4709
 
 
4710
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
4711
  goto __pyx_L0;
 
4712
  __pyx_L1_error:;
 
4713
  __Pyx_XDECREF(__pyx_1);
 
4714
  __Pyx_XDECREF(__pyx_2);
 
4715
  __Pyx_XDECREF(__pyx_t_2);
 
4716
  __Pyx_XDECREF(__pyx_t_3);
 
4717
  __Pyx_XDECREF(__pyx_t_4);
 
4718
  __Pyx_AddTraceback("tseries.getMergeVec");
 
4719
  __pyx_r = NULL;
 
4720
  __pyx_L0:;
 
4721
  __Pyx_DECREF((PyObject *)__pyx_v_itervals);
 
4722
  __Pyx_DECREF(__pyx_v_val);
 
4723
  __Pyx_DECREF((PyObject *)__pyx_v_fillVec);
 
4724
  __Pyx_DECREF((PyObject *)__pyx_v_maskVec);
 
4725
  __Pyx_XGIVEREF(__pyx_r);
 
4726
  __Pyx_FinishRefcountContext();
 
4727
  return __pyx_r;
 
4728
}
 
4729
 
 
4730
/* "pandas/lib/src/tseries.pyx":550
 
4731
 * cdef double NEGINF = -INF
 
4732
 * 
 
4733
 * cdef inline _checknull(object val):             # <<<<<<<<<<<<<<
 
4734
 *     return val is None or val != val or val == INF or val == NEGINF
 
4735
 * 
 
4736
 */
 
4737
 
 
4738
static INLINE PyObject *__pyx_f_7tseries__checknull(PyObject *__pyx_v_val) {
 
4739
  PyObject *__pyx_r = NULL;
 
4740
  int __pyx_t_1;
 
4741
  PyObject *__pyx_t_2 = NULL;
 
4742
  PyObject *__pyx_t_3 = NULL;
 
4743
  PyObject *__pyx_t_4 = NULL;
 
4744
  PyObject *__pyx_t_5 = NULL;
 
4745
  PyObject *__pyx_t_6 = NULL;
 
4746
  __Pyx_SetupRefcountContext("_checknull");
 
4747
 
 
4748
  /* "pandas/lib/src/tseries.pyx":551
 
4749
 * 
 
4750
 * cdef inline _checknull(object val):
 
4751
 *     return val is None or val != val or val == INF or val == NEGINF             # <<<<<<<<<<<<<<
 
4752
 * 
 
4753
 * cdef ndarray _isnullobj(input):
 
4754
 */
 
4755
  __Pyx_XDECREF(__pyx_r);
 
4756
  __pyx_t_1 = (__pyx_v_val == Py_None);
 
4757
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4758
  __Pyx_GOTREF(__pyx_t_2);
 
4759
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4760
  if (!__pyx_t_1) {
 
4761
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4762
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4763
    __Pyx_GOTREF(__pyx_t_3);
 
4764
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4765
    if (!__pyx_t_1) {
 
4766
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4767
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_7tseries_INF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4768
      __Pyx_GOTREF(__pyx_t_4);
 
4769
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_val, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4770
      __Pyx_GOTREF(__pyx_t_5);
 
4771
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
4772
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4773
      if (!__pyx_t_1) {
 
4774
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
4775
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_7tseries_NEGINF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4776
        __Pyx_GOTREF(__pyx_t_4);
 
4777
        __pyx_t_6 = PyObject_RichCompare(__pyx_v_val, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4778
        __Pyx_GOTREF(__pyx_t_6);
 
4779
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
4780
        __pyx_t_4 = __pyx_t_6;
 
4781
        __pyx_t_6 = 0;
 
4782
      } else {
 
4783
        __pyx_t_4 = __pyx_t_5;
 
4784
        __pyx_t_5 = 0;
 
4785
      }
 
4786
      __pyx_t_5 = __pyx_t_4;
 
4787
      __pyx_t_4 = 0;
 
4788
    } else {
 
4789
      __pyx_t_5 = __pyx_t_3;
 
4790
      __pyx_t_3 = 0;
 
4791
    }
 
4792
    __pyx_t_3 = __pyx_t_5;
 
4793
    __pyx_t_5 = 0;
 
4794
  } else {
 
4795
    __pyx_t_3 = __pyx_t_2;
 
4796
    __pyx_t_2 = 0;
 
4797
  }
 
4798
  __pyx_r = __pyx_t_3;
 
4799
  __pyx_t_3 = 0;
 
4800
  goto __pyx_L0;
 
4801
 
 
4802
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
4803
  goto __pyx_L0;
 
4804
  __pyx_L1_error:;
 
4805
  __Pyx_XDECREF(__pyx_t_2);
 
4806
  __Pyx_XDECREF(__pyx_t_3);
 
4807
  __Pyx_XDECREF(__pyx_t_4);
 
4808
  __Pyx_XDECREF(__pyx_t_5);
 
4809
  __Pyx_XDECREF(__pyx_t_6);
 
4810
  __Pyx_AddTraceback("tseries._checknull");
 
4811
  __pyx_r = 0;
 
4812
  __pyx_L0:;
 
4813
  __Pyx_XGIVEREF(__pyx_r);
 
4814
  __Pyx_FinishRefcountContext();
 
4815
  return __pyx_r;
 
4816
}
 
4817
 
 
4818
/* "pandas/lib/src/tseries.pyx":553
 
4819
 *     return val is None or val != val or val == INF or val == NEGINF
 
4820
 * 
 
4821
 * cdef ndarray _isnullobj(input):             # <<<<<<<<<<<<<<
 
4822
 *     cdef int i, length
 
4823
 *     cdef object val
 
4824
 */
 
4825
 
 
4826
static  PyArrayObject *__pyx_f_7tseries__isnullobj(PyObject *__pyx_v_input) {
 
4827
  int __pyx_v_i;
 
4828
  int __pyx_v_length;
 
4829
  PyObject *__pyx_v_val;
 
4830
  PyArrayObject *__pyx_v_result;
 
4831
  PyArrayIterObject *__pyx_v_iter;
 
4832
  Py_buffer __pyx_bstruct_result;
 
4833
  Py_ssize_t __pyx_bstride_0_result = 0;
 
4834
  Py_ssize_t __pyx_bshape_0_result = 0;
 
4835
  PyArrayObject *__pyx_r = NULL;
 
4836
  PyObject *__pyx_1 = 0;
 
4837
  PyObject *__pyx_2 = 0;
 
4838
  PyObject *__pyx_t_1 = NULL;
 
4839
  PyObject *__pyx_t_2 = NULL;
 
4840
  PyObject *__pyx_t_3 = NULL;
 
4841
  PyArrayObject *__pyx_t_4 = NULL;
 
4842
  int __pyx_t_5;
 
4843
  PyObject *__pyx_t_6 = NULL;
 
4844
  PyObject *__pyx_t_7 = NULL;
 
4845
  PyObject *__pyx_t_8 = NULL;
 
4846
  int __pyx_t_9;
 
4847
  int __pyx_t_10;
 
4848
  int __pyx_t_11;
 
4849
  __Pyx_SetupRefcountContext("_isnullobj");
 
4850
  __pyx_v_val = Py_None; __Pyx_INCREF(Py_None);
 
4851
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
4852
  __pyx_v_iter = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
4853
  __pyx_bstruct_result.buf = NULL;
 
4854
 
 
4855
  /* "pandas/lib/src/tseries.pyx":559
 
4856
 *     cdef flatiter iter
 
4857
 * 
 
4858
 *     length = PyArray_SIZE(input)             # <<<<<<<<<<<<<<
 
4859
 * 
 
4860
 *     result = <ndarray> np.zeros(length, dtype=np.int8)
 
4861
 */
 
4862
  if (!(__Pyx_TypeTest(__pyx_v_input, __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4863
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_input));
 
4864
 
 
4865
  /* "pandas/lib/src/tseries.pyx":561
 
4866
 *     length = PyArray_SIZE(input)
 
4867
 * 
 
4868
 *     result = <ndarray> np.zeros(length, dtype=np.int8)             # <<<<<<<<<<<<<<
 
4869
 * 
 
4870
 *     iter= PyArray_IterNew(input)
 
4871
 */
 
4872
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4873
  __Pyx_GOTREF(__pyx_1);
 
4874
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4875
  __Pyx_GOTREF(__pyx_t_1);
 
4876
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
4877
  __pyx_t_2 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4878
  __Pyx_GOTREF(__pyx_t_2);
 
4879
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4880
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
4881
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
 
4882
  __Pyx_GIVEREF(__pyx_t_2);
 
4883
  __pyx_t_2 = 0;
 
4884
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4885
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
4886
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4887
  __Pyx_GOTREF(__pyx_2);
 
4888
  __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4889
  __Pyx_GOTREF(__pyx_t_2);
 
4890
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
4891
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4892
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4893
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4894
  __Pyx_GOTREF(__pyx_t_2);
 
4895
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4896
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
4897
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
4898
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
 
4899
  {
 
4900
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
4901
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
4902
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn_npy_int8, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
 
4903
    if (unlikely(__pyx_t_5 < 0)) {
 
4904
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
 
4905
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn_npy_int8, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
 
4906
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
 
4907
        __Pyx_RaiseBufferFallbackError();
 
4908
      } else {
 
4909
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
 
4910
      }
 
4911
    }
 
4912
    __pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
 
4913
    __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
 
4914
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4915
  }
 
4916
  __pyx_t_4 = 0;
 
4917
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
 
4918
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
4919
  __pyx_v_result = ((PyArrayObject *)__pyx_t_2);
 
4920
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4921
 
 
4922
  /* "pandas/lib/src/tseries.pyx":563
 
4923
 *     result = <ndarray> np.zeros(length, dtype=np.int8)
 
4924
 * 
 
4925
 *     iter= PyArray_IterNew(input)             # <<<<<<<<<<<<<<
 
4926
 * 
 
4927
 *     for i from 0 <= i < length:
 
4928
 */
 
4929
  __pyx_t_2 = PyArray_IterNew(__pyx_v_input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4930
  __Pyx_GOTREF(__pyx_t_2);
 
4931
  if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4932
  __Pyx_DECREF(((PyObject *)__pyx_v_iter));
 
4933
  __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_2);
 
4934
  __pyx_t_2 = 0;
 
4935
 
 
4936
  /* "pandas/lib/src/tseries.pyx":565
 
4937
 *     iter= PyArray_IterNew(input)
 
4938
 * 
 
4939
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
4940
 *         val = PyArray_GETITEM(input, <void *> iter.dataptr)
 
4941
 * 
 
4942
 */
 
4943
  __pyx_t_5 = __pyx_v_length;
 
4944
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
4945
 
 
4946
    /* "pandas/lib/src/tseries.pyx":566
 
4947
 * 
 
4948
 *     for i from 0 <= i < length:
 
4949
 *         val = PyArray_GETITEM(input, <void *> iter.dataptr)             # <<<<<<<<<<<<<<
 
4950
 * 
 
4951
 *         if _checknull(val):
 
4952
 */
 
4953
    __pyx_t_2 = PyArray_GETITEM(__pyx_v_input, ((void *)__pyx_v_iter->dataptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4954
    __Pyx_GOTREF(__pyx_t_2);
 
4955
    __Pyx_DECREF(__pyx_v_val);
 
4956
    __pyx_v_val = __pyx_t_2;
 
4957
    __pyx_t_2 = 0;
 
4958
 
 
4959
    /* "pandas/lib/src/tseries.pyx":568
 
4960
 *         val = PyArray_GETITEM(input, <void *> iter.dataptr)
 
4961
 * 
 
4962
 *         if _checknull(val):             # <<<<<<<<<<<<<<
 
4963
 *             result[i] = 1
 
4964
 * 
 
4965
 */
 
4966
    __pyx_t_2 = __pyx_f_7tseries__checknull(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4967
    __Pyx_GOTREF(__pyx_t_2);
 
4968
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4969
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4970
    if (__pyx_t_9) {
 
4971
 
 
4972
      /* "pandas/lib/src/tseries.pyx":569
 
4973
 * 
 
4974
 *         if _checknull(val):
 
4975
 *             result[i] = 1             # <<<<<<<<<<<<<<
 
4976
 * 
 
4977
 *         PyArray_ITER_NEXT(iter)
 
4978
 */
 
4979
      __pyx_t_10 = __pyx_v_i;
 
4980
      __pyx_t_11 = -1;
 
4981
      if (__pyx_t_10 < 0) {
 
4982
        __pyx_t_10 += __pyx_bshape_0_result;
 
4983
        if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
 
4984
      } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_result)) __pyx_t_11 = 0;
 
4985
      if (unlikely(__pyx_t_11 != -1)) {
 
4986
        __Pyx_RaiseBufferIndexError(__pyx_t_11);
 
4987
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4988
      }
 
4989
      *__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_result.buf, __pyx_t_10, __pyx_bstride_0_result) = 1;
 
4990
      goto __pyx_L5;
 
4991
    }
 
4992
    __pyx_L5:;
 
4993
 
 
4994
    /* "pandas/lib/src/tseries.pyx":571
 
4995
 *             result[i] = 1
 
4996
 * 
 
4997
 *         PyArray_ITER_NEXT(iter)             # <<<<<<<<<<<<<<
 
4998
 * 
 
4999
 *     return result
 
5000
 */
 
5001
    PyArray_ITER_NEXT(__pyx_v_iter);
 
5002
  }
 
5003
 
 
5004
  /* "pandas/lib/src/tseries.pyx":573
 
5005
 *         PyArray_ITER_NEXT(iter)
 
5006
 * 
 
5007
 *     return result             # <<<<<<<<<<<<<<
 
5008
 * 
 
5009
 * def isnull(input):
 
5010
 */
 
5011
  __Pyx_XDECREF(((PyObject *)__pyx_r));
 
5012
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
5013
  __pyx_r = ((PyArrayObject *)__pyx_v_result);
 
5014
  goto __pyx_L0;
 
5015
 
 
5016
  __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
5017
  goto __pyx_L0;
 
5018
  __pyx_L1_error:;
 
5019
  __Pyx_XDECREF(__pyx_1);
 
5020
  __Pyx_XDECREF(__pyx_2);
 
5021
  __Pyx_XDECREF(__pyx_t_1);
 
5022
  __Pyx_XDECREF(__pyx_t_2);
 
5023
  __Pyx_XDECREF(__pyx_t_3);
 
5024
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
5025
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
5026
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
5027
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
5028
  __Pyx_AddTraceback("tseries._isnullobj");
 
5029
  __pyx_r = 0;
 
5030
  goto __pyx_L2;
 
5031
  __pyx_L0:;
 
5032
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
5033
  __pyx_L2:;
 
5034
  __Pyx_DECREF(__pyx_v_val);
 
5035
  __Pyx_DECREF((PyObject *)__pyx_v_result);
 
5036
  __Pyx_DECREF((PyObject *)__pyx_v_iter);
 
5037
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
 
5038
  __Pyx_FinishRefcountContext();
 
5039
  return __pyx_r;
 
5040
}
 
5041
 
 
5042
/* "pandas/lib/src/tseries.pyx":575
 
5043
 *     return result
 
5044
 * 
 
5045
 * def isnull(input):             # <<<<<<<<<<<<<<
 
5046
 *     '''
 
5047
 *     Replacement for numpy.isnan / -numpy.isfinite which is suitable
 
5048
 */
 
5049
 
 
5050
static PyObject *__pyx_pf_7tseries_isnull(PyObject *__pyx_self, PyObject *__pyx_v_input); /*proto*/
 
5051
static char __pyx_doc_7tseries_isnull[] = "\n    Replacement for numpy.isnan / -numpy.isfinite which is suitable\n    for use on object arrays.\n\n    Parameters\n    ----------\n    arr: ndarray or object value\n    \n    Returns\n    -------\n    boolean ndarray or boolean\n    ";
 
5052
static PyObject *__pyx_pf_7tseries_isnull(PyObject *__pyx_self, PyObject *__pyx_v_input) {
 
5053
  PyArrayObject *__pyx_v_result;
 
5054
  Py_buffer __pyx_bstruct_result;
 
5055
  Py_ssize_t __pyx_bstride_0_result = 0;
 
5056
  Py_ssize_t __pyx_bshape_0_result = 0;
 
5057
  PyObject *__pyx_r = NULL;
 
5058
  PyObject *__pyx_1 = 0;
 
5059
  int __pyx_t_1;
 
5060
  PyObject *__pyx_t_2 = NULL;
 
5061
  PyObject *__pyx_t_3 = NULL;
 
5062
  int __pyx_t_4;
 
5063
  int __pyx_t_5;
 
5064
  int __pyx_t_6;
 
5065
  PyObject *__pyx_t_7 = NULL;
 
5066
  PyObject *__pyx_t_8 = NULL;
 
5067
  PyObject *__pyx_t_9 = NULL;
 
5068
  PyObject *__pyx_t_10 = NULL;
 
5069
  __Pyx_SetupRefcountContext("isnull");
 
5070
  __pyx_self = __pyx_self;
 
5071
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
5072
  __pyx_bstruct_result.buf = NULL;
 
5073
 
 
5074
  /* "pandas/lib/src/tseries.pyx":590
 
5075
 *     cdef ndarray[npy_int8, ndim=1] result
 
5076
 * 
 
5077
 *     if isinstance(input, np.ndarray):             # <<<<<<<<<<<<<<
 
5078
 *         if input.dtype.kind in ('O', 'S'):
 
5079
 *             result = _isnullobj(input)
 
5080
 */
 
5081
  __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_5numpy_ndarray))); 
 
5082
  if (__pyx_t_1) {
 
5083
 
 
5084
    /* "pandas/lib/src/tseries.pyx":591
 
5085
 * 
 
5086
 *     if isinstance(input, np.ndarray):
 
5087
 *         if input.dtype.kind in ('O', 'S'):             # <<<<<<<<<<<<<<
 
5088
 *             result = _isnullobj(input)
 
5089
 * 
 
5090
 */
 
5091
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_input, __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5092
    __Pyx_GOTREF(__pyx_t_2);
 
5093
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5094
    __Pyx_GOTREF(__pyx_t_3);
 
5095
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
5096
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_kp_38, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5097
    __Pyx_GOTREF(__pyx_t_2);
 
5098
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5099
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
5100
    if (!((int)__pyx_t_1)) {
 
5101
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_kp_39, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5102
      __Pyx_GOTREF(__pyx_t_2);
 
5103
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5104
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
5105
      __pyx_t_5 = ((int)__pyx_t_4);
 
5106
    } else {
 
5107
      __pyx_t_5 = ((int)__pyx_t_1);
 
5108
    }
 
5109
    __pyx_t_1 = __pyx_t_5;
 
5110
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
5111
    if (__pyx_t_1) {
 
5112
 
 
5113
      /* "pandas/lib/src/tseries.pyx":592
 
5114
 *     if isinstance(input, np.ndarray):
 
5115
 *         if input.dtype.kind in ('O', 'S'):
 
5116
 *             result = _isnullobj(input)             # <<<<<<<<<<<<<<
 
5117
 * 
 
5118
 *             return result.astype(np.bool)
 
5119
 */
 
5120
      __pyx_t_3 = ((PyObject *)__pyx_f_7tseries__isnullobj(__pyx_v_input)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5121
      __Pyx_GOTREF(__pyx_t_3);
 
5122
      {
 
5123
        __Pyx_BufFmt_StackElem __pyx_stack[1];
 
5124
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
5125
        __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn_npy_int8, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
 
5126
        if (unlikely(__pyx_t_6 < 0)) {
 
5127
          PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
 
5128
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn_npy_int8, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
 
5129
            Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
 
5130
            __Pyx_RaiseBufferFallbackError();
 
5131
          } else {
 
5132
            PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
 
5133
          }
 
5134
        }
 
5135
        __pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
 
5136
        __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
 
5137
        if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5138
      }
 
5139
      __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
5140
      __pyx_v_result = ((PyArrayObject *)__pyx_t_3);
 
5141
      __pyx_t_3 = 0;
 
5142
 
 
5143
      /* "pandas/lib/src/tseries.pyx":594
 
5144
 *             result = _isnullobj(input)
 
5145
 * 
 
5146
 *             return result.astype(np.bool)             # <<<<<<<<<<<<<<
 
5147
 *         else:
 
5148
 *             return -np.isfinite(input)
 
5149
 */
 
5150
      __Pyx_XDECREF(__pyx_r);
 
5151
      __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_kp_astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5152
      __Pyx_GOTREF(__pyx_t_3);
 
5153
      __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5154
      __Pyx_GOTREF(__pyx_1);
 
5155
      __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5156
      __Pyx_GOTREF(__pyx_t_2);
 
5157
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5158
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5159
      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
 
5160
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
 
5161
      __Pyx_GIVEREF(__pyx_t_2);
 
5162
      __pyx_t_2 = 0;
 
5163
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5164
      __Pyx_GOTREF(__pyx_t_2);
 
5165
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
5166
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
 
5167
      __pyx_r = __pyx_t_2;
 
5168
      __pyx_t_2 = 0;
 
5169
      goto __pyx_L0;
 
5170
      goto __pyx_L6;
 
5171
    }
 
5172
    /*else*/ {
 
5173
 
 
5174
      /* "pandas/lib/src/tseries.pyx":596
 
5175
 *             return result.astype(np.bool)
 
5176
 *         else:
 
5177
 *             return -np.isfinite(input)             # <<<<<<<<<<<<<<
 
5178
 *     else:
 
5179
 *         return _checknull(input)
 
5180
 */
 
5181
      __Pyx_XDECREF(__pyx_r);
 
5182
      __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5183
      __Pyx_GOTREF(__pyx_1);
 
5184
      __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_isfinite); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5185
      __Pyx_GOTREF(__pyx_t_2);
 
5186
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5187
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5188
      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
 
5189
      __Pyx_INCREF(__pyx_v_input);
 
5190
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_input);
 
5191
      __Pyx_GIVEREF(__pyx_v_input);
 
5192
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5193
      __Pyx_GOTREF(__pyx_t_3);
 
5194
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
5195
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
 
5196
      __pyx_1 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5197
      __Pyx_GOTREF(__pyx_1);
 
5198
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
5199
      __pyx_r = __pyx_1;
 
5200
      __pyx_1 = 0;
 
5201
      goto __pyx_L0;
 
5202
    }
 
5203
    __pyx_L6:;
 
5204
    goto __pyx_L5;
 
5205
  }
 
5206
  /*else*/ {
 
5207
 
 
5208
    /* "pandas/lib/src/tseries.pyx":598
 
5209
 *             return -np.isfinite(input)
 
5210
 *     else:
 
5211
 *         return _checknull(input)             # <<<<<<<<<<<<<<
 
5212
 * 
 
5213
 * def notnull(input):
 
5214
 */
 
5215
    __Pyx_XDECREF(__pyx_r);
 
5216
    __pyx_t_3 = __pyx_f_7tseries__checknull(__pyx_v_input); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5217
    __Pyx_GOTREF(__pyx_t_3);
 
5218
    __pyx_r = __pyx_t_3;
 
5219
    __pyx_t_3 = 0;
 
5220
    goto __pyx_L0;
 
5221
  }
 
5222
  __pyx_L5:;
 
5223
 
 
5224
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
5225
  goto __pyx_L0;
 
5226
  __pyx_L1_error:;
 
5227
  __Pyx_XDECREF(__pyx_1);
 
5228
  __Pyx_XDECREF(__pyx_t_2);
 
5229
  __Pyx_XDECREF(__pyx_t_3);
 
5230
  __Pyx_XDECREF(__pyx_t_10);
 
5231
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
5232
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
5233
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
5234
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
5235
  __Pyx_AddTraceback("tseries.isnull");
 
5236
  __pyx_r = NULL;
 
5237
  goto __pyx_L2;
 
5238
  __pyx_L0:;
 
5239
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
5240
  __pyx_L2:;
 
5241
  __Pyx_DECREF((PyObject *)__pyx_v_result);
 
5242
  __Pyx_XGIVEREF(__pyx_r);
 
5243
  __Pyx_FinishRefcountContext();
 
5244
  return __pyx_r;
 
5245
}
 
5246
 
 
5247
/* "pandas/lib/src/tseries.pyx":600
 
5248
 *         return _checknull(input)
 
5249
 * 
 
5250
 * def notnull(input):             # <<<<<<<<<<<<<<
 
5251
 *     '''
 
5252
 *     Replacement for numpy.isfinite / -numpy.isnan which is suitable
 
5253
 */
 
5254
 
 
5255
static PyObject *__pyx_pf_7tseries_notnull(PyObject *__pyx_self, PyObject *__pyx_v_input); /*proto*/
 
5256
static char __pyx_doc_7tseries_notnull[] = "\n    Replacement for numpy.isfinite / -numpy.isnan which is suitable\n    for use on object arrays.\n    \n    Parameters\n    ----------\n    arr: ndarray or object value\n    \n    Returns\n    -------\n    boolean ndarray or boolean\n    ";
 
5257
static PyObject *__pyx_pf_7tseries_notnull(PyObject *__pyx_self, PyObject *__pyx_v_input) {
 
5258
  PyObject *__pyx_r = NULL;
 
5259
  PyObject *__pyx_1 = 0;
 
5260
  int __pyx_t_1;
 
5261
  PyObject *__pyx_t_2 = NULL;
 
5262
  PyObject *__pyx_t_3 = NULL;
 
5263
  __Pyx_SetupRefcountContext("notnull");
 
5264
  __pyx_self = __pyx_self;
 
5265
 
 
5266
  /* "pandas/lib/src/tseries.pyx":613
 
5267
 *     boolean ndarray or boolean
 
5268
 *     '''
 
5269
 *     if isinstance(input, np.ndarray):             # <<<<<<<<<<<<<<
 
5270
 *         return -isnull(input)
 
5271
 *     else:
 
5272
 */
 
5273
  __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_5numpy_ndarray))); 
 
5274
  if (__pyx_t_1) {
 
5275
 
 
5276
    /* "pandas/lib/src/tseries.pyx":614
 
5277
 *     '''
 
5278
 *     if isinstance(input, np.ndarray):
 
5279
 *         return -isnull(input)             # <<<<<<<<<<<<<<
 
5280
 *     else:
 
5281
 *         return not bool(_checknull(input))
 
5282
 */
 
5283
    __Pyx_XDECREF(__pyx_r);
 
5284
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_isnull); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5285
    __Pyx_GOTREF(__pyx_1);
 
5286
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5287
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
5288
    __Pyx_INCREF(__pyx_v_input);
 
5289
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_input);
 
5290
    __Pyx_GIVEREF(__pyx_v_input);
 
5291
    __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5292
    __Pyx_GOTREF(__pyx_t_3);
 
5293
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5294
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
5295
    __pyx_1 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5296
    __Pyx_GOTREF(__pyx_1);
 
5297
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
5298
    __pyx_r = __pyx_1;
 
5299
    __pyx_1 = 0;
 
5300
    goto __pyx_L0;
 
5301
    goto __pyx_L5;
 
5302
  }
 
5303
  /*else*/ {
 
5304
 
 
5305
    /* "pandas/lib/src/tseries.pyx":616
 
5306
 *         return -isnull(input)
 
5307
 *     else:
 
5308
 *         return not bool(_checknull(input))             # <<<<<<<<<<<<<<
 
5309
 * 
 
5310
 * def reindexNew(ndarray index, ndarray arr, dict idxMap):
 
5311
 */
 
5312
    __Pyx_XDECREF(__pyx_r);
 
5313
    __pyx_t_3 = __pyx_f_7tseries__checknull(__pyx_v_input); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5314
    __Pyx_GOTREF(__pyx_t_3);
 
5315
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5316
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
5317
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
 
5318
    __Pyx_GIVEREF(__pyx_t_3);
 
5319
    __pyx_t_3 = 0;
 
5320
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyBool_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5321
    __Pyx_GOTREF(__pyx_t_3);
 
5322
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
5323
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5324
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
5325
    __pyx_t_3 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5326
    __Pyx_GOTREF(__pyx_t_3);
 
5327
    __pyx_r = __pyx_t_3;
 
5328
    __pyx_t_3 = 0;
 
5329
    goto __pyx_L0;
 
5330
  }
 
5331
  __pyx_L5:;
 
5332
 
 
5333
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
5334
  goto __pyx_L0;
 
5335
  __pyx_L1_error:;
 
5336
  __Pyx_XDECREF(__pyx_1);
 
5337
  __Pyx_XDECREF(__pyx_t_2);
 
5338
  __Pyx_XDECREF(__pyx_t_3);
 
5339
  __Pyx_AddTraceback("tseries.notnull");
 
5340
  __pyx_r = NULL;
 
5341
  __pyx_L0:;
 
5342
  __Pyx_XGIVEREF(__pyx_r);
 
5343
  __Pyx_FinishRefcountContext();
 
5344
  return __pyx_r;
 
5345
}
 
5346
 
 
5347
/* "pandas/lib/src/tseries.pyx":618
 
5348
 *         return not bool(_checknull(input))
 
5349
 * 
 
5350
 * def reindexNew(ndarray index, ndarray arr, dict idxMap):             # <<<<<<<<<<<<<<
 
5351
 *     '''
 
5352
 *     Using the provided new index, a given array, and a mapping of index-value
 
5353
 */
 
5354
 
 
5355
static PyObject *__pyx_pf_7tseries_reindexNew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
5356
static char __pyx_doc_7tseries_reindexNew[] = "\n    Using the provided new index, a given array, and a mapping of index-value\n    correpondences in the value array, return a new ndarray conforming to \n    the new index.\n    \n    This is significantly faster than doing it in pure Python.\n    ";
 
5357
static PyObject *__pyx_pf_7tseries_reindexNew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
5358
  PyArrayObject *__pyx_v_index = 0;
 
5359
  PyArrayObject *__pyx_v_arr = 0;
 
5360
  PyObject *__pyx_v_idxMap = 0;
 
5361
  PyArrayObject *__pyx_v_result;
 
5362
  double *__pyx_v_result_data;
 
5363
  int __pyx_v_i;
 
5364
  int __pyx_v_length;
 
5365
  PyArrayIterObject *__pyx_v_itera;
 
5366
  PyArrayIterObject *__pyx_v_iteridx;
 
5367
  double __pyx_v_nan;
 
5368
  PyObject *__pyx_v_idx;
 
5369
  PyObject *__pyx_r = NULL;
 
5370
  PyObject *__pyx_1 = 0;
 
5371
  PyObject *__pyx_t_1 = NULL;
 
5372
  double __pyx_t_2;
 
5373
  PyObject *__pyx_t_3 = NULL;
 
5374
  PyObject *__pyx_t_4 = NULL;
 
5375
  PyObject *__pyx_t_5 = NULL;
 
5376
  int __pyx_t_6;
 
5377
  int __pyx_t_7;
 
5378
  npy_intp __pyx_t_8;
 
5379
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_arr,&__pyx_kp_idxMap,0};
 
5380
  __Pyx_SetupRefcountContext("reindexNew");
 
5381
  __pyx_self = __pyx_self;
 
5382
  if (unlikely(__pyx_kwds)) {
 
5383
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
5384
    PyObject* values[3] = {0,0,0};
 
5385
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
5386
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
 
5387
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
5388
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
5389
      case  0: break;
 
5390
      default: goto __pyx_L5_argtuple_error;
 
5391
    }
 
5392
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
5393
      case  0:
 
5394
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
5395
      if (likely(values[0])) kw_args--;
 
5396
      else goto __pyx_L5_argtuple_error;
 
5397
      case  1:
 
5398
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_arr);
 
5399
      if (likely(values[1])) kw_args--;
 
5400
      else {
 
5401
        __Pyx_RaiseArgtupleInvalid("reindexNew", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
5402
      }
 
5403
      case  2:
 
5404
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_idxMap);
 
5405
      if (likely(values[2])) kw_args--;
 
5406
      else {
 
5407
        __Pyx_RaiseArgtupleInvalid("reindexNew", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
5408
      }
 
5409
    }
 
5410
    if (unlikely(kw_args > 0)) {
 
5411
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindexNew") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
5412
    }
 
5413
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
5414
    __pyx_v_arr = ((PyArrayObject *)values[1]);
 
5415
    __pyx_v_idxMap = ((PyObject *)values[2]);
 
5416
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
 
5417
    goto __pyx_L5_argtuple_error;
 
5418
  } else {
 
5419
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
5420
    __pyx_v_arr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
5421
    __pyx_v_idxMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
 
5422
  }
 
5423
  goto __pyx_L4_argument_unpacking_done;
 
5424
  __pyx_L5_argtuple_error:;
 
5425
  __Pyx_RaiseArgtupleInvalid("reindexNew", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
5426
  __pyx_L3_error:;
 
5427
  __Pyx_AddTraceback("tseries.reindexNew");
 
5428
  return NULL;
 
5429
  __pyx_L4_argument_unpacking_done:;
 
5430
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
5431
  __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
5432
  __pyx_v_iteridx = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
5433
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
5434
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5435
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5436
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idxMap), &PyDict_Type, 1, "idxMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5437
 
 
5438
  /* "pandas/lib/src/tseries.pyx":633
 
5439
 *     cdef object idx
 
5440
 * 
 
5441
 *     nan = <double> np.NaN             # <<<<<<<<<<<<<<
 
5442
 * 
 
5443
 *     length = PyArray_SIZE(index)
 
5444
 */
 
5445
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5446
  __Pyx_GOTREF(__pyx_1);
 
5447
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5448
  __Pyx_GOTREF(__pyx_t_1);
 
5449
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5450
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5451
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
5452
  __pyx_v_nan = ((double)__pyx_t_2);
 
5453
 
 
5454
  /* "pandas/lib/src/tseries.pyx":635
 
5455
 *     nan = <double> np.NaN
 
5456
 * 
 
5457
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 
5458
 * 
 
5459
 *     result = <ndarray> np.empty(length, np.float64)
 
5460
 */
 
5461
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5462
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_index));
 
5463
 
 
5464
  /* "pandas/lib/src/tseries.pyx":637
 
5465
 *     length = PyArray_SIZE(index)
 
5466
 * 
 
5467
 *     result = <ndarray> np.empty(length, np.float64)             # <<<<<<<<<<<<<<
 
5468
 * 
 
5469
 *     result_data = <double *> result.data
 
5470
 */
 
5471
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5472
  __Pyx_GOTREF(__pyx_1);
 
5473
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5474
  __Pyx_GOTREF(__pyx_t_1);
 
5475
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5476
  __pyx_t_3 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5477
  __Pyx_GOTREF(__pyx_t_3);
 
5478
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5479
  __Pyx_GOTREF(__pyx_1);
 
5480
  __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5481
  __Pyx_GOTREF(__pyx_t_4);
 
5482
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5483
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5484
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
5485
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
 
5486
  __Pyx_GIVEREF(__pyx_t_3);
 
5487
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
 
5488
  __Pyx_GIVEREF(__pyx_t_4);
 
5489
  __pyx_t_3 = 0;
 
5490
  __pyx_t_4 = 0;
 
5491
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5492
  __Pyx_GOTREF(__pyx_t_4);
 
5493
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
5494
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
5495
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
5496
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
5497
  __pyx_v_result = ((PyArrayObject *)__pyx_t_4);
 
5498
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5499
 
 
5500
  /* "pandas/lib/src/tseries.pyx":639
 
5501
 *     result = <ndarray> np.empty(length, np.float64)
 
5502
 * 
 
5503
 *     result_data = <double *> result.data             # <<<<<<<<<<<<<<
 
5504
 * 
 
5505
 *     itera = PyArray_IterNew(arr)
 
5506
 */
 
5507
  __pyx_v_result_data = ((double *)__pyx_v_result->data);
 
5508
 
 
5509
  /* "pandas/lib/src/tseries.pyx":641
 
5510
 *     result_data = <double *> result.data
 
5511
 * 
 
5512
 *     itera = PyArray_IterNew(arr)             # <<<<<<<<<<<<<<
 
5513
 *     iteridx = PyArray_IterNew(index)
 
5514
 * 
 
5515
 */
 
5516
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_arr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5517
  __Pyx_GOTREF(__pyx_t_4);
 
5518
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5519
  __Pyx_DECREF(((PyObject *)__pyx_v_itera));
 
5520
  __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_4);
 
5521
  __pyx_t_4 = 0;
 
5522
 
 
5523
  /* "pandas/lib/src/tseries.pyx":642
 
5524
 * 
 
5525
 *     itera = PyArray_IterNew(arr)
 
5526
 *     iteridx = PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 
5527
 * 
 
5528
 *     for i from 0 <= i < length:
 
5529
 */
 
5530
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5531
  __Pyx_GOTREF(__pyx_t_4);
 
5532
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5533
  __Pyx_DECREF(((PyObject *)__pyx_v_iteridx));
 
5534
  __pyx_v_iteridx = ((PyArrayIterObject *)__pyx_t_4);
 
5535
  __pyx_t_4 = 0;
 
5536
 
 
5537
  /* "pandas/lib/src/tseries.pyx":644
 
5538
 *     iteridx = PyArray_IterNew(index)
 
5539
 * 
 
5540
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
5541
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
5542
 *         PyArray_ITER_NEXT(iteridx)
 
5543
 */
 
5544
  __pyx_t_6 = __pyx_v_length;
 
5545
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
 
5546
 
 
5547
    /* "pandas/lib/src/tseries.pyx":645
 
5548
 * 
 
5549
 *     for i from 0 <= i < length:
 
5550
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)             # <<<<<<<<<<<<<<
 
5551
 *         PyArray_ITER_NEXT(iteridx)
 
5552
 *         if idx not in idxMap:
 
5553
 */
 
5554
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_index), ((void *)__pyx_v_iteridx->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5555
    __Pyx_GOTREF(__pyx_t_4);
 
5556
    __Pyx_DECREF(__pyx_v_idx);
 
5557
    __pyx_v_idx = __pyx_t_4;
 
5558
    __pyx_t_4 = 0;
 
5559
 
 
5560
    /* "pandas/lib/src/tseries.pyx":646
 
5561
 *     for i from 0 <= i < length:
 
5562
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
5563
 *         PyArray_ITER_NEXT(iteridx)             # <<<<<<<<<<<<<<
 
5564
 *         if idx not in idxMap:
 
5565
 *             result_data[i] = nan
 
5566
 */
 
5567
    PyArray_ITER_NEXT(__pyx_v_iteridx);
 
5568
 
 
5569
    /* "pandas/lib/src/tseries.pyx":647
 
5570
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
5571
 *         PyArray_ITER_NEXT(iteridx)
 
5572
 *         if idx not in idxMap:             # <<<<<<<<<<<<<<
 
5573
 *             result_data[i] = nan
 
5574
 *             continue
 
5575
 */
 
5576
    __pyx_t_7 = (!PySequence_Contains(((PyObject *)__pyx_v_idxMap), __pyx_v_idx)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5577
    if (__pyx_t_7) {
 
5578
 
 
5579
      /* "pandas/lib/src/tseries.pyx":648
 
5580
 *         PyArray_ITER_NEXT(iteridx)
 
5581
 *         if idx not in idxMap:
 
5582
 *             result_data[i] = nan             # <<<<<<<<<<<<<<
 
5583
 *             continue
 
5584
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
5585
 */
 
5586
      (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_nan;
 
5587
 
 
5588
      /* "pandas/lib/src/tseries.pyx":649
 
5589
 *         if idx not in idxMap:
 
5590
 *             result_data[i] = nan
 
5591
 *             continue             # <<<<<<<<<<<<<<
 
5592
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
5593
 *         result_data[i] = (<double *>(itera.dataptr))[0]
 
5594
 */
 
5595
      goto __pyx_L6_continue;
 
5596
      goto __pyx_L8;
 
5597
    }
 
5598
    __pyx_L8:;
 
5599
 
 
5600
    /* "pandas/lib/src/tseries.pyx":650
 
5601
 *             result_data[i] = nan
 
5602
 *             continue
 
5603
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])             # <<<<<<<<<<<<<<
 
5604
 *         result_data[i] = (<double *>(itera.dataptr))[0]
 
5605
 * 
 
5606
 */
 
5607
    __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_idxMap), __pyx_v_idx); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5608
    __Pyx_GOTREF(__pyx_1);
 
5609
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5610
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5611
    PyArray_ITER_GOTO1D(__pyx_v_itera, __pyx_t_8);
 
5612
 
 
5613
    /* "pandas/lib/src/tseries.pyx":651
 
5614
 *             continue
 
5615
 *         PyArray_ITER_GOTO1D(itera, idxMap[idx])
 
5616
 *         result_data[i] = (<double *>(itera.dataptr))[0]             # <<<<<<<<<<<<<<
 
5617
 * 
 
5618
 *     return result
 
5619
 */
 
5620
    (__pyx_v_result_data[__pyx_v_i]) = (((double *)__pyx_v_itera->dataptr)[0]);
 
5621
    __pyx_L6_continue:;
 
5622
  }
 
5623
 
 
5624
  /* "pandas/lib/src/tseries.pyx":653
 
5625
 *         result_data[i] = (<double *>(itera.dataptr))[0]
 
5626
 * 
 
5627
 *     return result             # <<<<<<<<<<<<<<
 
5628
 * 
 
5629
 * cdef double __add(double a, double b):
 
5630
 */
 
5631
  __Pyx_XDECREF(__pyx_r);
 
5632
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
5633
  __pyx_r = ((PyObject *)__pyx_v_result);
 
5634
  goto __pyx_L0;
 
5635
 
 
5636
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
5637
  goto __pyx_L0;
 
5638
  __pyx_L1_error:;
 
5639
  __Pyx_XDECREF(__pyx_1);
 
5640
  __Pyx_XDECREF(__pyx_t_1);
 
5641
  __Pyx_XDECREF(__pyx_t_3);
 
5642
  __Pyx_XDECREF(__pyx_t_4);
 
5643
  __Pyx_XDECREF(__pyx_t_5);
 
5644
  __Pyx_AddTraceback("tseries.reindexNew");
 
5645
  __pyx_r = NULL;
 
5646
  __pyx_L0:;
 
5647
  __Pyx_DECREF((PyObject *)__pyx_v_result);
 
5648
  __Pyx_DECREF((PyObject *)__pyx_v_itera);
 
5649
  __Pyx_DECREF((PyObject *)__pyx_v_iteridx);
 
5650
  __Pyx_DECREF(__pyx_v_idx);
 
5651
  __Pyx_XGIVEREF(__pyx_r);
 
5652
  __Pyx_FinishRefcountContext();
 
5653
  return __pyx_r;
 
5654
}
 
5655
 
 
5656
/* "pandas/lib/src/tseries.pyx":655
 
5657
 *     return result
 
5658
 * 
 
5659
 * cdef double __add(double a, double b):             # <<<<<<<<<<<<<<
 
5660
 *     return a + b
 
5661
 * cdef double __sub(double a, double b):
 
5662
 */
 
5663
 
 
5664
static  double __pyx_f_7tseries___add(double __pyx_v_a, double __pyx_v_b) {
 
5665
  double __pyx_r;
 
5666
  __Pyx_SetupRefcountContext("__add");
 
5667
 
 
5668
  /* "pandas/lib/src/tseries.pyx":656
 
5669
 * 
 
5670
 * cdef double __add(double a, double b):
 
5671
 *     return a + b             # <<<<<<<<<<<<<<
 
5672
 * cdef double __sub(double a, double b):
 
5673
 *     return a - b
 
5674
 */
 
5675
  __pyx_r = (__pyx_v_a + __pyx_v_b);
 
5676
  goto __pyx_L0;
 
5677
 
 
5678
  __pyx_r = 0;
 
5679
  __pyx_L0:;
 
5680
  __Pyx_FinishRefcountContext();
 
5681
  return __pyx_r;
 
5682
}
 
5683
 
 
5684
/* "pandas/lib/src/tseries.pyx":657
 
5685
 * cdef double __add(double a, double b):
 
5686
 *     return a + b
 
5687
 * cdef double __sub(double a, double b):             # <<<<<<<<<<<<<<
 
5688
 *     return a - b
 
5689
 * cdef double __div(double a, double b):
 
5690
 */
 
5691
 
 
5692
static  double __pyx_f_7tseries___sub(double __pyx_v_a, double __pyx_v_b) {
 
5693
  double __pyx_r;
 
5694
  __Pyx_SetupRefcountContext("__sub");
 
5695
 
 
5696
  /* "pandas/lib/src/tseries.pyx":658
 
5697
 *     return a + b
 
5698
 * cdef double __sub(double a, double b):
 
5699
 *     return a - b             # <<<<<<<<<<<<<<
 
5700
 * cdef double __div(double a, double b):
 
5701
 *     return a / b
 
5702
 */
 
5703
  __pyx_r = (__pyx_v_a - __pyx_v_b);
 
5704
  goto __pyx_L0;
 
5705
 
 
5706
  __pyx_r = 0;
 
5707
  __pyx_L0:;
 
5708
  __Pyx_FinishRefcountContext();
 
5709
  return __pyx_r;
 
5710
}
 
5711
 
 
5712
/* "pandas/lib/src/tseries.pyx":659
 
5713
 * cdef double __sub(double a, double b):
 
5714
 *     return a - b
 
5715
 * cdef double __div(double a, double b):             # <<<<<<<<<<<<<<
 
5716
 *     return a / b
 
5717
 * cdef double __mul(double a, double b):
 
5718
 */
 
5719
 
 
5720
static  double __pyx_f_7tseries___div(double __pyx_v_a, double __pyx_v_b) {
 
5721
  double __pyx_r;
 
5722
  __Pyx_SetupRefcountContext("__div");
 
5723
 
 
5724
  /* "pandas/lib/src/tseries.pyx":660
 
5725
 *     return a - b
 
5726
 * cdef double __div(double a, double b):
 
5727
 *     return a / b             # <<<<<<<<<<<<<<
 
5728
 * cdef double __mul(double a, double b):
 
5729
 *     return a * b
 
5730
 */
 
5731
  __pyx_r = (__pyx_v_a / __pyx_v_b);
 
5732
  goto __pyx_L0;
 
5733
 
 
5734
  __pyx_r = 0;
 
5735
  __pyx_L0:;
 
5736
  __Pyx_FinishRefcountContext();
 
5737
  return __pyx_r;
 
5738
}
 
5739
 
 
5740
/* "pandas/lib/src/tseries.pyx":661
 
5741
 * cdef double __div(double a, double b):
 
5742
 *     return a / b
 
5743
 * cdef double __mul(double a, double b):             # <<<<<<<<<<<<<<
 
5744
 *     return a * b
 
5745
 * cdef double __eq(double a, double b):
 
5746
 */
 
5747
 
 
5748
static  double __pyx_f_7tseries___mul(double __pyx_v_a, double __pyx_v_b) {
 
5749
  double __pyx_r;
 
5750
  __Pyx_SetupRefcountContext("__mul");
 
5751
 
 
5752
  /* "pandas/lib/src/tseries.pyx":662
 
5753
 *     return a / b
 
5754
 * cdef double __mul(double a, double b):
 
5755
 *     return a * b             # <<<<<<<<<<<<<<
 
5756
 * cdef double __eq(double a, double b):
 
5757
 *     return a == b
 
5758
 */
 
5759
  __pyx_r = (__pyx_v_a * __pyx_v_b);
 
5760
  goto __pyx_L0;
 
5761
 
 
5762
  __pyx_r = 0;
 
5763
  __pyx_L0:;
 
5764
  __Pyx_FinishRefcountContext();
 
5765
  return __pyx_r;
 
5766
}
 
5767
 
 
5768
/* "pandas/lib/src/tseries.pyx":663
 
5769
 * cdef double __mul(double a, double b):
 
5770
 *     return a * b
 
5771
 * cdef double __eq(double a, double b):             # <<<<<<<<<<<<<<
 
5772
 *     return a == b
 
5773
 * cdef double __ne(double a, double b):
 
5774
 */
 
5775
 
 
5776
static  double __pyx_f_7tseries___eq(double __pyx_v_a, double __pyx_v_b) {
 
5777
  double __pyx_r;
 
5778
  __Pyx_SetupRefcountContext("__eq");
 
5779
 
 
5780
  /* "pandas/lib/src/tseries.pyx":664
 
5781
 *     return a * b
 
5782
 * cdef double __eq(double a, double b):
 
5783
 *     return a == b             # <<<<<<<<<<<<<<
 
5784
 * cdef double __ne(double a, double b):
 
5785
 *     return a != b
 
5786
 */
 
5787
  __pyx_r = (__pyx_v_a == __pyx_v_b);
 
5788
  goto __pyx_L0;
 
5789
 
 
5790
  __pyx_r = 0;
 
5791
  __pyx_L0:;
 
5792
  __Pyx_FinishRefcountContext();
 
5793
  return __pyx_r;
 
5794
}
 
5795
 
 
5796
/* "pandas/lib/src/tseries.pyx":665
 
5797
 * cdef double __eq(double a, double b):
 
5798
 *     return a == b
 
5799
 * cdef double __ne(double a, double b):             # <<<<<<<<<<<<<<
 
5800
 *     return a != b
 
5801
 * cdef double __lt(double a, double b):
 
5802
 */
 
5803
 
 
5804
static  double __pyx_f_7tseries___ne(double __pyx_v_a, double __pyx_v_b) {
 
5805
  double __pyx_r;
 
5806
  __Pyx_SetupRefcountContext("__ne");
 
5807
 
 
5808
  /* "pandas/lib/src/tseries.pyx":666
 
5809
 *     return a == b
 
5810
 * cdef double __ne(double a, double b):
 
5811
 *     return a != b             # <<<<<<<<<<<<<<
 
5812
 * cdef double __lt(double a, double b):
 
5813
 *     return a < b
 
5814
 */
 
5815
  __pyx_r = (__pyx_v_a != __pyx_v_b);
 
5816
  goto __pyx_L0;
 
5817
 
 
5818
  __pyx_r = 0;
 
5819
  __pyx_L0:;
 
5820
  __Pyx_FinishRefcountContext();
 
5821
  return __pyx_r;
 
5822
}
 
5823
 
 
5824
/* "pandas/lib/src/tseries.pyx":667
 
5825
 * cdef double __ne(double a, double b):
 
5826
 *     return a != b
 
5827
 * cdef double __lt(double a, double b):             # <<<<<<<<<<<<<<
 
5828
 *     return a < b
 
5829
 * cdef double __gt(double a, double b):
 
5830
 */
 
5831
 
 
5832
static  double __pyx_f_7tseries___lt(double __pyx_v_a, double __pyx_v_b) {
 
5833
  double __pyx_r;
 
5834
  __Pyx_SetupRefcountContext("__lt");
 
5835
 
 
5836
  /* "pandas/lib/src/tseries.pyx":668
 
5837
 *     return a != b
 
5838
 * cdef double __lt(double a, double b):
 
5839
 *     return a < b             # <<<<<<<<<<<<<<
 
5840
 * cdef double __gt(double a, double b):
 
5841
 *     return a > b
 
5842
 */
 
5843
  __pyx_r = (__pyx_v_a < __pyx_v_b);
 
5844
  goto __pyx_L0;
 
5845
 
 
5846
  __pyx_r = 0;
 
5847
  __pyx_L0:;
 
5848
  __Pyx_FinishRefcountContext();
 
5849
  return __pyx_r;
 
5850
}
 
5851
 
 
5852
/* "pandas/lib/src/tseries.pyx":669
 
5853
 * cdef double __lt(double a, double b):
 
5854
 *     return a < b
 
5855
 * cdef double __gt(double a, double b):             # <<<<<<<<<<<<<<
 
5856
 *     return a > b
 
5857
 * cdef double __pow(double a, double b):
 
5858
 */
 
5859
 
 
5860
static  double __pyx_f_7tseries___gt(double __pyx_v_a, double __pyx_v_b) {
 
5861
  double __pyx_r;
 
5862
  __Pyx_SetupRefcountContext("__gt");
 
5863
 
 
5864
  /* "pandas/lib/src/tseries.pyx":670
 
5865
 *     return a < b
 
5866
 * cdef double __gt(double a, double b):
 
5867
 *     return a > b             # <<<<<<<<<<<<<<
 
5868
 * cdef double __pow(double a, double b):
 
5869
 *     return a ** b
 
5870
 */
 
5871
  __pyx_r = (__pyx_v_a > __pyx_v_b);
 
5872
  goto __pyx_L0;
 
5873
 
 
5874
  __pyx_r = 0;
 
5875
  __pyx_L0:;
 
5876
  __Pyx_FinishRefcountContext();
 
5877
  return __pyx_r;
 
5878
}
 
5879
 
 
5880
/* "pandas/lib/src/tseries.pyx":671
 
5881
 * cdef double __gt(double a, double b):
 
5882
 *     return a > b
 
5883
 * cdef double __pow(double a, double b):             # <<<<<<<<<<<<<<
 
5884
 *     return a ** b
 
5885
 * 
 
5886
 */
 
5887
 
 
5888
static  double __pyx_f_7tseries___pow(double __pyx_v_a, double __pyx_v_b) {
 
5889
  double __pyx_r;
 
5890
  __Pyx_SetupRefcountContext("__pow");
 
5891
 
 
5892
  /* "pandas/lib/src/tseries.pyx":672
 
5893
 *     return a > b
 
5894
 * cdef double __pow(double a, double b):
 
5895
 *     return a ** b             # <<<<<<<<<<<<<<
 
5896
 * 
 
5897
 * ctypedef double (* double_func)(double a, double b)
 
5898
 */
 
5899
  __pyx_r = pow(__pyx_v_a, __pyx_v_b);
 
5900
  goto __pyx_L0;
 
5901
 
 
5902
  __pyx_r = 0;
 
5903
  __pyx_L0:;
 
5904
  __Pyx_FinishRefcountContext();
 
5905
  return __pyx_r;
 
5906
}
 
5907
 
 
5908
/* "pandas/lib/src/tseries.pyx":676
 
5909
 * ctypedef double (* double_func)(double a, double b)
 
5910
 * 
 
5911
 * cdef ndarray _applyFunc(double_func func, ndarray index, object ao,             # <<<<<<<<<<<<<<
 
5912
 *                         object bo, dict aMap, dict bMap):
 
5913
 *     '''
 
5914
 */
 
5915
 
 
5916
static  PyArrayObject *__pyx_f_7tseries__applyFunc(__pyx_t_7tseries_double_func __pyx_v_func, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_ao, PyObject *__pyx_v_bo, PyObject *__pyx_v_aMap, PyObject *__pyx_v_bMap) {
 
5917
  PyArrayObject *__pyx_v_A;
 
5918
  PyArrayObject *__pyx_v_B;
 
5919
  PyArrayObject *__pyx_v_result;
 
5920
  double *__pyx_v_result_data;
 
5921
  int __pyx_v_i;
 
5922
  int __pyx_v_length;
 
5923
  PyArrayIterObject *__pyx_v_itera;
 
5924
  PyArrayIterObject *__pyx_v_iterb;
 
5925
  PyArrayIterObject *__pyx_v_iteridx;
 
5926
  double __pyx_v_nan;
 
5927
  PyObject *__pyx_v_idx;
 
5928
  PyArrayObject *__pyx_r = NULL;
 
5929
  PyObject *__pyx_1 = 0;
 
5930
  PyObject *__pyx_t_1 = NULL;
 
5931
  double __pyx_t_2;
 
5932
  PyObject *__pyx_t_3 = NULL;
 
5933
  PyObject *__pyx_t_4 = NULL;
 
5934
  PyObject *__pyx_t_5 = NULL;
 
5935
  int __pyx_t_6;
 
5936
  int __pyx_t_7;
 
5937
  int __pyx_t_8;
 
5938
  int __pyx_t_9;
 
5939
  Py_ssize_t __pyx_t_10;
 
5940
  Py_ssize_t __pyx_t_11;
 
5941
  __Pyx_SetupRefcountContext("_applyFunc");
 
5942
  __pyx_v_A = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
5943
  __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
5944
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
5945
  __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
5946
  __pyx_v_iterb = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
5947
  __pyx_v_iteridx = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
 
5948
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
5949
 
 
5950
  /* "pandas/lib/src/tseries.pyx":690
 
5951
 *     # This is EXTREMELY important, otherwise you will get very
 
5952
 *     # undesired results
 
5953
 *     A = PyArray_ContiguousFromAny(ao, NPY_DOUBLE, 1, 1)             # <<<<<<<<<<<<<<
 
5954
 *     B = PyArray_ContiguousFromAny(bo, NPY_DOUBLE, 1, 1)
 
5955
 * 
 
5956
 */
 
5957
  __pyx_t_1 = PyArray_ContiguousFromAny(__pyx_v_ao, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5958
  __Pyx_GOTREF(__pyx_t_1);
 
5959
  if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5960
  __Pyx_DECREF(((PyObject *)__pyx_v_A));
 
5961
  __pyx_v_A = ((PyArrayObject *)__pyx_t_1);
 
5962
  __pyx_t_1 = 0;
 
5963
 
 
5964
  /* "pandas/lib/src/tseries.pyx":691
 
5965
 *     # undesired results
 
5966
 *     A = PyArray_ContiguousFromAny(ao, NPY_DOUBLE, 1, 1)
 
5967
 *     B = PyArray_ContiguousFromAny(bo, NPY_DOUBLE, 1, 1)             # <<<<<<<<<<<<<<
 
5968
 * 
 
5969
 *     nan = <double> np.NaN
 
5970
 */
 
5971
  __pyx_t_1 = PyArray_ContiguousFromAny(__pyx_v_bo, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5972
  __Pyx_GOTREF(__pyx_t_1);
 
5973
  if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5974
  __Pyx_DECREF(((PyObject *)__pyx_v_B));
 
5975
  __pyx_v_B = ((PyArrayObject *)__pyx_t_1);
 
5976
  __pyx_t_1 = 0;
 
5977
 
 
5978
  /* "pandas/lib/src/tseries.pyx":693
 
5979
 *     B = PyArray_ContiguousFromAny(bo, NPY_DOUBLE, 1, 1)
 
5980
 * 
 
5981
 *     nan = <double> np.NaN             # <<<<<<<<<<<<<<
 
5982
 *     length = PyArray_SIZE(index)
 
5983
 * 
 
5984
 */
 
5985
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5986
  __Pyx_GOTREF(__pyx_1);
 
5987
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5988
  __Pyx_GOTREF(__pyx_t_1);
 
5989
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
5990
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5991
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
5992
  __pyx_v_nan = ((double)__pyx_t_2);
 
5993
 
 
5994
  /* "pandas/lib/src/tseries.pyx":694
 
5995
 * 
 
5996
 *     nan = <double> np.NaN
 
5997
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 
5998
 * 
 
5999
 *     result = <ndarray> np.empty(length, np.float64)
 
6000
 */
 
6001
  if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_7tseries_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6002
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_index));
 
6003
 
 
6004
  /* "pandas/lib/src/tseries.pyx":696
 
6005
 *     length = PyArray_SIZE(index)
 
6006
 * 
 
6007
 *     result = <ndarray> np.empty(length, np.float64)             # <<<<<<<<<<<<<<
 
6008
 *     result_data = <double *>result.data
 
6009
 * 
 
6010
 */
 
6011
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6012
  __Pyx_GOTREF(__pyx_1);
 
6013
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6014
  __Pyx_GOTREF(__pyx_t_1);
 
6015
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
6016
  __pyx_t_3 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6017
  __Pyx_GOTREF(__pyx_t_3);
 
6018
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6019
  __Pyx_GOTREF(__pyx_1);
 
6020
  __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6021
  __Pyx_GOTREF(__pyx_t_4);
 
6022
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
6023
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6024
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
6025
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
 
6026
  __Pyx_GIVEREF(__pyx_t_3);
 
6027
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
 
6028
  __Pyx_GIVEREF(__pyx_t_4);
 
6029
  __pyx_t_3 = 0;
 
6030
  __pyx_t_4 = 0;
 
6031
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6032
  __Pyx_GOTREF(__pyx_t_4);
 
6033
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6034
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
6035
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
 
6036
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
6037
  __pyx_v_result = ((PyArrayObject *)__pyx_t_4);
 
6038
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
6039
 
 
6040
  /* "pandas/lib/src/tseries.pyx":697
 
6041
 * 
 
6042
 *     result = <ndarray> np.empty(length, np.float64)
 
6043
 *     result_data = <double *>result.data             # <<<<<<<<<<<<<<
 
6044
 * 
 
6045
 *     itera = <flatiter> PyArray_IterNew(A)
 
6046
 */
 
6047
  __pyx_v_result_data = ((double *)__pyx_v_result->data);
 
6048
 
 
6049
  /* "pandas/lib/src/tseries.pyx":699
 
6050
 *     result_data = <double *>result.data
 
6051
 * 
 
6052
 *     itera = <flatiter> PyArray_IterNew(A)             # <<<<<<<<<<<<<<
 
6053
 *     iterb = <flatiter> PyArray_IterNew(B)
 
6054
 *     iteridx = PyArray_IterNew(index)
 
6055
 */
 
6056
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_A)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6057
  __Pyx_GOTREF(__pyx_t_4);
 
6058
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_4)));
 
6059
  __Pyx_DECREF(((PyObject *)__pyx_v_itera));
 
6060
  __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_4);
 
6061
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
6062
 
 
6063
  /* "pandas/lib/src/tseries.pyx":700
 
6064
 * 
 
6065
 *     itera = <flatiter> PyArray_IterNew(A)
 
6066
 *     iterb = <flatiter> PyArray_IterNew(B)             # <<<<<<<<<<<<<<
 
6067
 *     iteridx = PyArray_IterNew(index)
 
6068
 * 
 
6069
 */
 
6070
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_B)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6071
  __Pyx_GOTREF(__pyx_t_4);
 
6072
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_4)));
 
6073
  __Pyx_DECREF(((PyObject *)__pyx_v_iterb));
 
6074
  __pyx_v_iterb = ((PyArrayIterObject *)__pyx_t_4);
 
6075
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
6076
 
 
6077
  /* "pandas/lib/src/tseries.pyx":701
 
6078
 *     itera = <flatiter> PyArray_IterNew(A)
 
6079
 *     iterb = <flatiter> PyArray_IterNew(B)
 
6080
 *     iteridx = PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 
6081
 * 
 
6082
 *     for i from 0 <= i < length:
 
6083
 */
 
6084
  __pyx_t_4 = PyArray_IterNew(((PyObject *)__pyx_v_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6085
  __Pyx_GOTREF(__pyx_t_4);
 
6086
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7tseries_flatiter))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6087
  __Pyx_DECREF(((PyObject *)__pyx_v_iteridx));
 
6088
  __pyx_v_iteridx = ((PyArrayIterObject *)__pyx_t_4);
 
6089
  __pyx_t_4 = 0;
 
6090
 
 
6091
  /* "pandas/lib/src/tseries.pyx":703
 
6092
 *     iteridx = PyArray_IterNew(index)
 
6093
 * 
 
6094
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
6095
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
6096
 *         PyArray_ITER_NEXT(iteridx)
 
6097
 */
 
6098
  __pyx_t_6 = __pyx_v_length;
 
6099
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
 
6100
 
 
6101
    /* "pandas/lib/src/tseries.pyx":704
 
6102
 * 
 
6103
 *     for i from 0 <= i < length:
 
6104
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)             # <<<<<<<<<<<<<<
 
6105
 *         PyArray_ITER_NEXT(iteridx)
 
6106
 * 
 
6107
 */
 
6108
    __pyx_t_4 = PyArray_GETITEM(((PyObject *)__pyx_v_index), ((void *)__pyx_v_iteridx->dataptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6109
    __Pyx_GOTREF(__pyx_t_4);
 
6110
    __Pyx_DECREF(__pyx_v_idx);
 
6111
    __pyx_v_idx = __pyx_t_4;
 
6112
    __pyx_t_4 = 0;
 
6113
 
 
6114
    /* "pandas/lib/src/tseries.pyx":705
 
6115
 *     for i from 0 <= i < length:
 
6116
 *         idx = PyArray_GETITEM(index, <void *> iteridx.dataptr)
 
6117
 *         PyArray_ITER_NEXT(iteridx)             # <<<<<<<<<<<<<<
 
6118
 * 
 
6119
 *         if idx not in aMap or idx not in bMap:
 
6120
 */
 
6121
    PyArray_ITER_NEXT(__pyx_v_iteridx);
 
6122
 
 
6123
    /* "pandas/lib/src/tseries.pyx":707
 
6124
 *         PyArray_ITER_NEXT(iteridx)
 
6125
 * 
 
6126
 *         if idx not in aMap or idx not in bMap:             # <<<<<<<<<<<<<<
 
6127
 *             result_data[i] = nan
 
6128
 *             continue
 
6129
 */
 
6130
    __pyx_t_7 = (!PySequence_Contains(((PyObject *)__pyx_v_aMap), __pyx_v_idx)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6131
    if (!__pyx_t_7) {
 
6132
      __pyx_t_8 = (!PySequence_Contains(((PyObject *)__pyx_v_bMap), __pyx_v_idx)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6133
      __pyx_t_9 = __pyx_t_8;
 
6134
    } else {
 
6135
      __pyx_t_9 = __pyx_t_7;
 
6136
    }
 
6137
    if (__pyx_t_9) {
 
6138
 
 
6139
      /* "pandas/lib/src/tseries.pyx":708
 
6140
 * 
 
6141
 *         if idx not in aMap or idx not in bMap:
 
6142
 *             result_data[i] = nan             # <<<<<<<<<<<<<<
 
6143
 *             continue
 
6144
 * 
 
6145
 */
 
6146
      (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_nan;
 
6147
 
 
6148
      /* "pandas/lib/src/tseries.pyx":709
 
6149
 *         if idx not in aMap or idx not in bMap:
 
6150
 *             result_data[i] = nan
 
6151
 *             continue             # <<<<<<<<<<<<<<
 
6152
 * 
 
6153
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],
 
6154
 */
 
6155
      goto __pyx_L3_continue;
 
6156
      goto __pyx_L5;
 
6157
    }
 
6158
    __pyx_L5:;
 
6159
 
 
6160
    /* "pandas/lib/src/tseries.pyx":711
 
6161
 *             continue
 
6162
 * 
 
6163
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],             # <<<<<<<<<<<<<<
 
6164
 *                             (<double *>B.data)[bMap[idx]])
 
6165
 * 
 
6166
 */
 
6167
    __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_aMap), __pyx_v_idx); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6168
    __Pyx_GOTREF(__pyx_1);
 
6169
    __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_1); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6170
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
6171
 
 
6172
    /* "pandas/lib/src/tseries.pyx":712
 
6173
 * 
 
6174
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],
 
6175
 *                             (<double *>B.data)[bMap[idx]])             # <<<<<<<<<<<<<<
 
6176
 * 
 
6177
 *     return result
 
6178
 */
 
6179
    __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_bMap), __pyx_v_idx); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6180
    __Pyx_GOTREF(__pyx_1);
 
6181
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_1); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6182
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
6183
 
 
6184
    /* "pandas/lib/src/tseries.pyx":711
 
6185
 *             continue
 
6186
 * 
 
6187
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],             # <<<<<<<<<<<<<<
 
6188
 *                             (<double *>B.data)[bMap[idx]])
 
6189
 * 
 
6190
 */
 
6191
    (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_func((((double *)__pyx_v_A->data)[__pyx_t_10]), (((double *)__pyx_v_B->data)[__pyx_t_11]));
 
6192
    __pyx_L3_continue:;
 
6193
  }
 
6194
 
 
6195
  /* "pandas/lib/src/tseries.pyx":714
 
6196
 *                             (<double *>B.data)[bMap[idx]])
 
6197
 * 
 
6198
 *     return result             # <<<<<<<<<<<<<<
 
6199
 * 
 
6200
 * def combineFunc(object name, ndarray index, object ao,
 
6201
 */
 
6202
  __Pyx_XDECREF(((PyObject *)__pyx_r));
 
6203
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
6204
  __pyx_r = __pyx_v_result;
 
6205
  goto __pyx_L0;
 
6206
 
 
6207
  __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
 
6208
  goto __pyx_L0;
 
6209
  __pyx_L1_error:;
 
6210
  __Pyx_XDECREF(__pyx_1);
 
6211
  __Pyx_XDECREF(__pyx_t_1);
 
6212
  __Pyx_XDECREF(__pyx_t_3);
 
6213
  __Pyx_XDECREF(__pyx_t_4);
 
6214
  __Pyx_XDECREF(__pyx_t_5);
 
6215
  __Pyx_AddTraceback("tseries._applyFunc");
 
6216
  __pyx_r = 0;
 
6217
  __pyx_L0:;
 
6218
  __Pyx_DECREF((PyObject *)__pyx_v_A);
 
6219
  __Pyx_DECREF((PyObject *)__pyx_v_B);
 
6220
  __Pyx_DECREF((PyObject *)__pyx_v_result);
 
6221
  __Pyx_DECREF((PyObject *)__pyx_v_itera);
 
6222
  __Pyx_DECREF((PyObject *)__pyx_v_iterb);
 
6223
  __Pyx_DECREF((PyObject *)__pyx_v_iteridx);
 
6224
  __Pyx_DECREF(__pyx_v_idx);
 
6225
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
 
6226
  __Pyx_FinishRefcountContext();
 
6227
  return __pyx_r;
 
6228
}
 
6229
 
 
6230
/* "pandas/lib/src/tseries.pyx":716
 
6231
 *     return result
 
6232
 * 
 
6233
 * def combineFunc(object name, ndarray index, object ao,             # <<<<<<<<<<<<<<
 
6234
 *                 object bo, dict aMap, dict bMap):
 
6235
 *     '''
 
6236
 */
 
6237
 
 
6238
static PyObject *__pyx_pf_7tseries_combineFunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
6239
static char __pyx_doc_7tseries_combineFunc[] = "\n    Combine two series (values and index maps for each passed in) using the \n    indicated function.\n    ";
 
6240
static PyObject *__pyx_pf_7tseries_combineFunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
6241
  PyObject *__pyx_v_name = 0;
 
6242
  PyArrayObject *__pyx_v_index = 0;
 
6243
  PyObject *__pyx_v_ao = 0;
 
6244
  PyObject *__pyx_v_bo = 0;
 
6245
  PyObject *__pyx_v_aMap = 0;
 
6246
  PyObject *__pyx_v_bMap = 0;
 
6247
  PyObject *__pyx_r = NULL;
 
6248
  PyObject *__pyx_t_1 = NULL;
 
6249
  int __pyx_t_2;
 
6250
  PyObject *__pyx_t_3 = NULL;
 
6251
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_name,&__pyx_kp_index,&__pyx_kp_ao,&__pyx_kp_bo,&__pyx_kp_aMap,&__pyx_kp_bMap,0};
 
6252
  __Pyx_SetupRefcountContext("combineFunc");
 
6253
  __pyx_self = __pyx_self;
 
6254
  if (unlikely(__pyx_kwds)) {
 
6255
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
6256
    PyObject* values[6] = {0,0,0,0,0,0};
 
6257
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
6258
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
 
6259
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
 
6260
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
 
6261
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
 
6262
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
6263
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
6264
      case  0: break;
 
6265
      default: goto __pyx_L5_argtuple_error;
 
6266
    }
 
6267
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
6268
      case  0:
 
6269
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_name);
 
6270
      if (likely(values[0])) kw_args--;
 
6271
      else goto __pyx_L5_argtuple_error;
 
6272
      case  1:
 
6273
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
6274
      if (likely(values[1])) kw_args--;
 
6275
      else {
 
6276
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6277
      }
 
6278
      case  2:
 
6279
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_ao);
 
6280
      if (likely(values[2])) kw_args--;
 
6281
      else {
 
6282
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6283
      }
 
6284
      case  3:
 
6285
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_bo);
 
6286
      if (likely(values[3])) kw_args--;
 
6287
      else {
 
6288
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6289
      }
 
6290
      case  4:
 
6291
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_aMap);
 
6292
      if (likely(values[4])) kw_args--;
 
6293
      else {
 
6294
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6295
      }
 
6296
      case  5:
 
6297
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_bMap);
 
6298
      if (likely(values[5])) kw_args--;
 
6299
      else {
 
6300
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6301
      }
 
6302
    }
 
6303
    if (unlikely(kw_args > 0)) {
 
6304
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "combineFunc") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6305
    }
 
6306
    __pyx_v_name = values[0];
 
6307
    __pyx_v_index = ((PyArrayObject *)values[1]);
 
6308
    __pyx_v_ao = values[2];
 
6309
    __pyx_v_bo = values[3];
 
6310
    __pyx_v_aMap = ((PyObject *)values[4]);
 
6311
    __pyx_v_bMap = ((PyObject *)values[5]);
 
6312
  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
 
6313
    goto __pyx_L5_argtuple_error;
 
6314
  } else {
 
6315
    __pyx_v_name = PyTuple_GET_ITEM(__pyx_args, 0);
 
6316
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
6317
    __pyx_v_ao = PyTuple_GET_ITEM(__pyx_args, 2);
 
6318
    __pyx_v_bo = PyTuple_GET_ITEM(__pyx_args, 3);
 
6319
    __pyx_v_aMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 4));
 
6320
    __pyx_v_bMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 5));
 
6321
  }
 
6322
  goto __pyx_L4_argument_unpacking_done;
 
6323
  __pyx_L5_argtuple_error:;
 
6324
  __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6325
  __pyx_L3_error:;
 
6326
  __Pyx_AddTraceback("tseries.combineFunc");
 
6327
  return NULL;
 
6328
  __pyx_L4_argument_unpacking_done:;
 
6329
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6330
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aMap), &PyDict_Type, 1, "aMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6331
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bMap), &PyDict_Type, 1, "bMap", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6332
 
 
6333
  /* "pandas/lib/src/tseries.pyx":722
 
6334
 *     indicated function.
 
6335
 *     '''
 
6336
 *     if name == "__add__":             # <<<<<<<<<<<<<<
 
6337
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)
 
6338
 *     elif name == "__sub__":
 
6339
 */
 
6340
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_40, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6341
  __Pyx_GOTREF(__pyx_t_1);
 
6342
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6343
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6344
  if (__pyx_t_2) {
 
6345
 
 
6346
    /* "pandas/lib/src/tseries.pyx":723
 
6347
 *     '''
 
6348
 *     if name == "__add__":
 
6349
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6350
 *     elif name == "__sub__":
 
6351
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 
6352
 */
 
6353
    __Pyx_XDECREF(__pyx_r);
 
6354
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___add, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6355
    __Pyx_GOTREF(__pyx_t_1);
 
6356
    __pyx_r = __pyx_t_1;
 
6357
    __pyx_t_1 = 0;
 
6358
    goto __pyx_L0;
 
6359
    goto __pyx_L6;
 
6360
  }
 
6361
 
 
6362
  /* "pandas/lib/src/tseries.pyx":724
 
6363
 *     if name == "__add__":
 
6364
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)
 
6365
 *     elif name == "__sub__":             # <<<<<<<<<<<<<<
 
6366
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 
6367
 *     elif name == "__div__":
 
6368
 */
 
6369
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_41, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6370
  __Pyx_GOTREF(__pyx_t_1);
 
6371
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6372
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6373
  if (__pyx_t_2) {
 
6374
 
 
6375
    /* "pandas/lib/src/tseries.pyx":725
 
6376
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)
 
6377
 *     elif name == "__sub__":
 
6378
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6379
 *     elif name == "__div__":
 
6380
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 
6381
 */
 
6382
    __Pyx_XDECREF(__pyx_r);
 
6383
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___sub, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6384
    __Pyx_GOTREF(__pyx_t_1);
 
6385
    __pyx_r = __pyx_t_1;
 
6386
    __pyx_t_1 = 0;
 
6387
    goto __pyx_L0;
 
6388
    goto __pyx_L6;
 
6389
  }
 
6390
 
 
6391
  /* "pandas/lib/src/tseries.pyx":726
 
6392
 *     elif name == "__sub__":
 
6393
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 
6394
 *     elif name == "__div__":             # <<<<<<<<<<<<<<
 
6395
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 
6396
 *     elif name == "__mul__":
 
6397
 */
 
6398
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_42, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6399
  __Pyx_GOTREF(__pyx_t_1);
 
6400
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6401
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6402
  if (__pyx_t_2) {
 
6403
 
 
6404
    /* "pandas/lib/src/tseries.pyx":727
 
6405
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 
6406
 *     elif name == "__div__":
 
6407
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6408
 *     elif name == "__mul__":
 
6409
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 
6410
 */
 
6411
    __Pyx_XDECREF(__pyx_r);
 
6412
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___div, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6413
    __Pyx_GOTREF(__pyx_t_1);
 
6414
    __pyx_r = __pyx_t_1;
 
6415
    __pyx_t_1 = 0;
 
6416
    goto __pyx_L0;
 
6417
    goto __pyx_L6;
 
6418
  }
 
6419
 
 
6420
  /* "pandas/lib/src/tseries.pyx":728
 
6421
 *     elif name == "__div__":
 
6422
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 
6423
 *     elif name == "__mul__":             # <<<<<<<<<<<<<<
 
6424
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 
6425
 *     elif name == "__eq__":
 
6426
 */
 
6427
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_43, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6428
  __Pyx_GOTREF(__pyx_t_1);
 
6429
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6430
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6431
  if (__pyx_t_2) {
 
6432
 
 
6433
    /* "pandas/lib/src/tseries.pyx":729
 
6434
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 
6435
 *     elif name == "__mul__":
 
6436
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6437
 *     elif name == "__eq__":
 
6438
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 
6439
 */
 
6440
    __Pyx_XDECREF(__pyx_r);
 
6441
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___mul, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6442
    __Pyx_GOTREF(__pyx_t_1);
 
6443
    __pyx_r = __pyx_t_1;
 
6444
    __pyx_t_1 = 0;
 
6445
    goto __pyx_L0;
 
6446
    goto __pyx_L6;
 
6447
  }
 
6448
 
 
6449
  /* "pandas/lib/src/tseries.pyx":730
 
6450
 *     elif name == "__mul__":
 
6451
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 
6452
 *     elif name == "__eq__":             # <<<<<<<<<<<<<<
 
6453
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 
6454
 *     elif name == "__ne__":
 
6455
 */
 
6456
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_44, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6457
  __Pyx_GOTREF(__pyx_t_1);
 
6458
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6459
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6460
  if (__pyx_t_2) {
 
6461
 
 
6462
    /* "pandas/lib/src/tseries.pyx":731
 
6463
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 
6464
 *     elif name == "__eq__":
 
6465
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6466
 *     elif name == "__ne__":
 
6467
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 
6468
 */
 
6469
    __Pyx_XDECREF(__pyx_r);
 
6470
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___eq, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6471
    __Pyx_GOTREF(__pyx_t_1);
 
6472
    __pyx_r = __pyx_t_1;
 
6473
    __pyx_t_1 = 0;
 
6474
    goto __pyx_L0;
 
6475
    goto __pyx_L6;
 
6476
  }
 
6477
 
 
6478
  /* "pandas/lib/src/tseries.pyx":732
 
6479
 *     elif name == "__eq__":
 
6480
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 
6481
 *     elif name == "__ne__":             # <<<<<<<<<<<<<<
 
6482
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 
6483
 *     elif name == "__lt__":
 
6484
 */
 
6485
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_45, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6486
  __Pyx_GOTREF(__pyx_t_1);
 
6487
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6488
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6489
  if (__pyx_t_2) {
 
6490
 
 
6491
    /* "pandas/lib/src/tseries.pyx":733
 
6492
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 
6493
 *     elif name == "__ne__":
 
6494
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6495
 *     elif name == "__lt__":
 
6496
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 
6497
 */
 
6498
    __Pyx_XDECREF(__pyx_r);
 
6499
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___ne, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6500
    __Pyx_GOTREF(__pyx_t_1);
 
6501
    __pyx_r = __pyx_t_1;
 
6502
    __pyx_t_1 = 0;
 
6503
    goto __pyx_L0;
 
6504
    goto __pyx_L6;
 
6505
  }
 
6506
 
 
6507
  /* "pandas/lib/src/tseries.pyx":734
 
6508
 *     elif name == "__ne__":
 
6509
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 
6510
 *     elif name == "__lt__":             # <<<<<<<<<<<<<<
 
6511
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 
6512
 *     elif name == "__gt__":
 
6513
 */
 
6514
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_46, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6515
  __Pyx_GOTREF(__pyx_t_1);
 
6516
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6517
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6518
  if (__pyx_t_2) {
 
6519
 
 
6520
    /* "pandas/lib/src/tseries.pyx":735
 
6521
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 
6522
 *     elif name == "__lt__":
 
6523
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6524
 *     elif name == "__gt__":
 
6525
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 
6526
 */
 
6527
    __Pyx_XDECREF(__pyx_r);
 
6528
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___lt, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6529
    __Pyx_GOTREF(__pyx_t_1);
 
6530
    __pyx_r = __pyx_t_1;
 
6531
    __pyx_t_1 = 0;
 
6532
    goto __pyx_L0;
 
6533
    goto __pyx_L6;
 
6534
  }
 
6535
 
 
6536
  /* "pandas/lib/src/tseries.pyx":736
 
6537
 *     elif name == "__lt__":
 
6538
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 
6539
 *     elif name == "__gt__":             # <<<<<<<<<<<<<<
 
6540
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 
6541
 *     elif name == "__pow__":
 
6542
 */
 
6543
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_47, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6544
  __Pyx_GOTREF(__pyx_t_1);
 
6545
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6546
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6547
  if (__pyx_t_2) {
 
6548
 
 
6549
    /* "pandas/lib/src/tseries.pyx":737
 
6550
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 
6551
 *     elif name == "__gt__":
 
6552
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6553
 *     elif name == "__pow__":
 
6554
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)
 
6555
 */
 
6556
    __Pyx_XDECREF(__pyx_r);
 
6557
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___gt, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6558
    __Pyx_GOTREF(__pyx_t_1);
 
6559
    __pyx_r = __pyx_t_1;
 
6560
    __pyx_t_1 = 0;
 
6561
    goto __pyx_L0;
 
6562
    goto __pyx_L6;
 
6563
  }
 
6564
 
 
6565
  /* "pandas/lib/src/tseries.pyx":738
 
6566
 *     elif name == "__gt__":
 
6567
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 
6568
 *     elif name == "__pow__":             # <<<<<<<<<<<<<<
 
6569
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)
 
6570
 *     else:
 
6571
 */
 
6572
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_48, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6573
  __Pyx_GOTREF(__pyx_t_1);
 
6574
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6575
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6576
  if (__pyx_t_2) {
 
6577
 
 
6578
    /* "pandas/lib/src/tseries.pyx":739
 
6579
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 
6580
 *     elif name == "__pow__":
 
6581
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 
6582
 *     else:
 
6583
 *         raise Exception('bad funcname requested of Cython code')
 
6584
 */
 
6585
    __Pyx_XDECREF(__pyx_r);
 
6586
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___pow, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6587
    __Pyx_GOTREF(__pyx_t_1);
 
6588
    __pyx_r = __pyx_t_1;
 
6589
    __pyx_t_1 = 0;
 
6590
    goto __pyx_L0;
 
6591
    goto __pyx_L6;
 
6592
  }
 
6593
  /*else*/ {
 
6594
 
 
6595
    /* "pandas/lib/src/tseries.pyx":741
 
6596
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)
 
6597
 *     else:
 
6598
 *         raise Exception('bad funcname requested of Cython code')             # <<<<<<<<<<<<<<
 
6599
 * 
 
6600
 * #-------------------------------------------------------------------------------
 
6601
 */
 
6602
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6603
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
6604
    __Pyx_INCREF(__pyx_kp_49);
 
6605
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_49);
 
6606
    __Pyx_GIVEREF(__pyx_kp_49);
 
6607
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6608
    __Pyx_GOTREF(__pyx_t_3);
 
6609
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
6610
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
6611
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
6612
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6613
  }
 
6614
  __pyx_L6:;
 
6615
 
 
6616
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
6617
  goto __pyx_L0;
 
6618
  __pyx_L1_error:;
 
6619
  __Pyx_XDECREF(__pyx_t_1);
 
6620
  __Pyx_XDECREF(__pyx_t_3);
 
6621
  __Pyx_AddTraceback("tseries.combineFunc");
 
6622
  __pyx_r = NULL;
 
6623
  __pyx_L0:;
 
6624
  __Pyx_XGIVEREF(__pyx_r);
 
6625
  __Pyx_FinishRefcountContext();
 
6626
  return __pyx_r;
 
6627
}
 
6628
 
 
6629
/* "pandas/lib/src/tseries.pyx":747
 
6630
 * 
 
6631
 * @cython.boundscheck(False)
 
6632
 * def arrmap(ndarray[object, ndim=1] index, object func):             # <<<<<<<<<<<<<<
 
6633
 *     cdef int length = index.shape[0]
 
6634
 *     cdef int i = 0
 
6635
 */
 
6636
 
 
6637
static PyObject *__pyx_pf_7tseries_arrmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
6638
static PyObject *__pyx_pf_7tseries_arrmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
6639
  PyArrayObject *__pyx_v_index = 0;
 
6640
  PyObject *__pyx_v_func = 0;
 
6641
  int __pyx_v_length;
 
6642
  int __pyx_v_i;
 
6643
  PyArrayObject *__pyx_v_result = 0;
 
6644
  Py_buffer __pyx_bstruct_index;
 
6645
  Py_ssize_t __pyx_bstride_0_index = 0;
 
6646
  Py_ssize_t __pyx_bshape_0_index = 0;
 
6647
  Py_buffer __pyx_bstruct_result;
 
6648
  Py_ssize_t __pyx_bstride_0_result = 0;
 
6649
  Py_ssize_t __pyx_bshape_0_result = 0;
 
6650
  PyObject *__pyx_r = NULL;
 
6651
  PyObject *__pyx_1 = 0;
 
6652
  PyObject *__pyx_2 = 0;
 
6653
  PyObject *__pyx_t_1 = NULL;
 
6654
  PyObject *__pyx_t_2 = NULL;
 
6655
  PyObject *__pyx_t_3 = NULL;
 
6656
  PyArrayObject *__pyx_t_4 = NULL;
 
6657
  int __pyx_t_5;
 
6658
  int __pyx_t_6;
 
6659
  int __pyx_t_7;
 
6660
  PyObject **__pyx_t_8;
 
6661
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_func,0};
 
6662
  __Pyx_SetupRefcountContext("arrmap");
 
6663
  __pyx_self = __pyx_self;
 
6664
  if (unlikely(__pyx_kwds)) {
 
6665
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
6666
    PyObject* values[2] = {0,0};
 
6667
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
6668
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
6669
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
6670
      case  0: break;
 
6671
      default: goto __pyx_L5_argtuple_error;
 
6672
    }
 
6673
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
6674
      case  0:
 
6675
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
6676
      if (likely(values[0])) kw_args--;
 
6677
      else goto __pyx_L5_argtuple_error;
 
6678
      case  1:
 
6679
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_func);
 
6680
      if (likely(values[1])) kw_args--;
 
6681
      else {
 
6682
        __Pyx_RaiseArgtupleInvalid("arrmap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6683
      }
 
6684
    }
 
6685
    if (unlikely(kw_args > 0)) {
 
6686
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "arrmap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6687
    }
 
6688
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
6689
    __pyx_v_func = values[1];
 
6690
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
 
6691
    goto __pyx_L5_argtuple_error;
 
6692
  } else {
 
6693
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
6694
    __pyx_v_func = PyTuple_GET_ITEM(__pyx_args, 1);
 
6695
  }
 
6696
  goto __pyx_L4_argument_unpacking_done;
 
6697
  __pyx_L5_argtuple_error:;
 
6698
  __Pyx_RaiseArgtupleInvalid("arrmap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6699
  __pyx_L3_error:;
 
6700
  __Pyx_AddTraceback("tseries.arrmap");
 
6701
  return NULL;
 
6702
  __pyx_L4_argument_unpacking_done:;
 
6703
  __pyx_bstruct_result.buf = NULL;
 
6704
  __pyx_bstruct_index.buf = NULL;
 
6705
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6706
  {
 
6707
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
6708
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6709
  }
 
6710
  __pyx_bstride_0_index = __pyx_bstruct_index.strides[0];
 
6711
  __pyx_bshape_0_index = __pyx_bstruct_index.shape[0];
 
6712
 
 
6713
  /* "pandas/lib/src/tseries.pyx":748
 
6714
 * @cython.boundscheck(False)
 
6715
 * def arrmap(ndarray[object, ndim=1] index, object func):
 
6716
 *     cdef int length = index.shape[0]             # <<<<<<<<<<<<<<
 
6717
 *     cdef int i = 0
 
6718
 * 
 
6719
 */
 
6720
  __pyx_v_length = (__pyx_v_index->dimensions[0]);
 
6721
 
 
6722
  /* "pandas/lib/src/tseries.pyx":749
 
6723
 * def arrmap(ndarray[object, ndim=1] index, object func):
 
6724
 *     cdef int length = index.shape[0]
 
6725
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 
6726
 * 
 
6727
 *     cdef ndarray[object, ndim=1] result = np.empty(length, dtype=np.object_)
 
6728
 */
 
6729
  __pyx_v_i = 0;
 
6730
 
 
6731
  /* "pandas/lib/src/tseries.pyx":751
 
6732
 *     cdef int i = 0
 
6733
 * 
 
6734
 *     cdef ndarray[object, ndim=1] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 
6735
 * 
 
6736
 *     for i from 0 <= i < length:
 
6737
 */
 
6738
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6739
  __Pyx_GOTREF(__pyx_1);
 
6740
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6741
  __Pyx_GOTREF(__pyx_t_1);
 
6742
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
6743
  __pyx_t_2 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6744
  __Pyx_GOTREF(__pyx_t_2);
 
6745
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6746
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
6747
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
 
6748
  __Pyx_GIVEREF(__pyx_t_2);
 
6749
  __pyx_t_2 = 0;
 
6750
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6751
  __Pyx_GOTREF(((PyObject *)__pyx_1));
 
6752
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6753
  __Pyx_GOTREF(__pyx_2);
 
6754
  __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_object_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6755
  __Pyx_GOTREF(__pyx_t_2);
 
6756
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
6757
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6758
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
6759
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6760
  __Pyx_GOTREF(__pyx_t_2);
 
6761
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
6762
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
6763
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
 
6764
  if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6765
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
 
6766
  {
 
6767
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
6768
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
 
6769
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_result.buf = NULL;
 
6770
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6771
    } else {__pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
 
6772
      __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
 
6773
    }
 
6774
  }
 
6775
  __pyx_t_4 = 0;
 
6776
  __pyx_v_result = ((PyArrayObject *)__pyx_t_2);
 
6777
  __pyx_t_2 = 0;
 
6778
 
 
6779
  /* "pandas/lib/src/tseries.pyx":753
 
6780
 *     cdef ndarray[object, ndim=1] result = np.empty(length, dtype=np.object_)
 
6781
 * 
 
6782
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
6783
 *         result[i] = func(index[i])
 
6784
 * 
 
6785
 */
 
6786
  __pyx_t_5 = __pyx_v_length;
 
6787
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
6788
 
 
6789
    /* "pandas/lib/src/tseries.pyx":754
 
6790
 * 
 
6791
 *     for i from 0 <= i < length:
 
6792
 *         result[i] = func(index[i])             # <<<<<<<<<<<<<<
 
6793
 * 
 
6794
 *     return result
 
6795
 */
 
6796
    __pyx_t_6 = __pyx_v_i;
 
6797
    if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_index;
 
6798
    __pyx_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_6, __pyx_bstride_0_index);
 
6799
    __Pyx_INCREF((PyObject*)__pyx_2);
 
6800
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6801
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
6802
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_2);
 
6803
    __Pyx_GIVEREF(__pyx_2);
 
6804
    __pyx_2 = 0;
 
6805
    __pyx_t_3 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6806
    __Pyx_GOTREF(__pyx_t_3);
 
6807
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
6808
    __pyx_t_7 = __pyx_v_i;
 
6809
    if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_result;
 
6810
    __pyx_t_8 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_7, __pyx_bstride_0_result);
 
6811
    __Pyx_GOTREF(*__pyx_t_8);
 
6812
    __Pyx_DECREF(*__pyx_t_8); __Pyx_INCREF(__pyx_t_3);
 
6813
    *__pyx_t_8 = __pyx_t_3;
 
6814
    __Pyx_GIVEREF(*__pyx_t_8);
 
6815
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
6816
  }
 
6817
 
 
6818
  /* "pandas/lib/src/tseries.pyx":756
 
6819
 *         result[i] = func(index[i])
 
6820
 * 
 
6821
 *     return result             # <<<<<<<<<<<<<<
 
6822
 * 
 
6823
 * @cython.boundscheck(False)
 
6824
 */
 
6825
  __Pyx_XDECREF(__pyx_r);
 
6826
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
6827
  __pyx_r = ((PyObject *)__pyx_v_result);
 
6828
  goto __pyx_L0;
 
6829
 
 
6830
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
6831
  goto __pyx_L0;
 
6832
  __pyx_L1_error:;
 
6833
  __Pyx_XDECREF(__pyx_1);
 
6834
  __Pyx_XDECREF(__pyx_2);
 
6835
  __Pyx_XDECREF(__pyx_t_1);
 
6836
  __Pyx_XDECREF(__pyx_t_2);
 
6837
  __Pyx_XDECREF(__pyx_t_3);
 
6838
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
6839
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
6840
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
6841
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
6842
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
6843
  __Pyx_AddTraceback("tseries.arrmap");
 
6844
  __pyx_r = NULL;
 
6845
  goto __pyx_L2;
 
6846
  __pyx_L0:;
 
6847
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
6848
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
 
6849
  __pyx_L2:;
 
6850
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
 
6851
  __Pyx_XGIVEREF(__pyx_r);
 
6852
  __Pyx_FinishRefcountContext();
 
6853
  return __pyx_r;
 
6854
}
 
6855
 
 
6856
/* "pandas/lib/src/tseries.pyx":759
 
6857
 * 
 
6858
 * @cython.boundscheck(False)
 
6859
 * def groupby_withnull_old(ndarray[object, ndim = 1] index, object keyfunc):             # <<<<<<<<<<<<<<
 
6860
 *     cdef dict groups
 
6861
 *     cdef int length = index.shape[0]
 
6862
 */
 
6863
 
 
6864
static PyObject *__pyx_pf_7tseries_groupby_withnull_old(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
6865
static PyObject *__pyx_pf_7tseries_groupby_withnull_old(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
6866
  PyArrayObject *__pyx_v_index = 0;
 
6867
  PyObject *__pyx_v_keyfunc = 0;
 
6868
  PyObject *__pyx_v_groups;
 
6869
  int __pyx_v_length;
 
6870
  PyObject *__pyx_v_idx;
 
6871
  PyObject *__pyx_v_curKey;
 
6872
  PyObject *__pyx_v_key;
 
6873
  PyObject *__pyx_v_members;
 
6874
  PyArrayObject *__pyx_v_mapped_index = 0;
 
6875
  PyArrayObject *__pyx_v_null_mask = 0;
 
6876
  PyObject *__pyx_v_bool_mask;
 
6877
  PyObject *__pyx_v_null_values;
 
6878
  int __pyx_v_i;
 
6879
  Py_buffer __pyx_bstruct_index;
 
6880
  Py_ssize_t __pyx_bstride_0_index = 0;
 
6881
  Py_ssize_t __pyx_bshape_0_index = 0;
 
6882
  Py_buffer __pyx_bstruct_null_mask;
 
6883
  Py_ssize_t __pyx_bstride_0_null_mask = 0;
 
6884
  Py_ssize_t __pyx_bshape_0_null_mask = 0;
 
6885
  Py_buffer __pyx_bstruct_mapped_index;
 
6886
  Py_ssize_t __pyx_bstride_0_mapped_index = 0;
 
6887
  Py_ssize_t __pyx_bshape_0_mapped_index = 0;
 
6888
  PyObject *__pyx_r = NULL;
 
6889
  PyObject *__pyx_1 = 0;
 
6890
  PyObject *__pyx_t_1 = NULL;
 
6891
  int __pyx_t_2;
 
6892
  PyObject *__pyx_t_3 = NULL;
 
6893
  PyArrayObject *__pyx_t_4 = NULL;
 
6894
  PyObject *__pyx_t_5 = NULL;
 
6895
  long __pyx_t_6;
 
6896
  long __pyx_t_7;
 
6897
  int __pyx_t_8;
 
6898
  npy_int8 __pyx_t_9;
 
6899
  int __pyx_t_10;
 
6900
  int __pyx_t_11;
 
6901
  int __pyx_t_12;
 
6902
  PyObject *__pyx_t_13;
 
6903
  int __pyx_t_14;
 
6904
  int __pyx_t_15;
 
6905
  int __pyx_t_16;
 
6906
  int __pyx_t_17;
 
6907
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_keyfunc,0};
 
6908
  __Pyx_SetupRefcountContext("groupby_withnull_old");
 
6909
  __pyx_self = __pyx_self;
 
6910
  if (unlikely(__pyx_kwds)) {
 
6911
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
6912
    PyObject* values[2] = {0,0};
 
6913
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
6914
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
6915
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
6916
      case  0: break;
 
6917
      default: goto __pyx_L5_argtuple_error;
 
6918
    }
 
6919
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
6920
      case  0:
 
6921
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
6922
      if (likely(values[0])) kw_args--;
 
6923
      else goto __pyx_L5_argtuple_error;
 
6924
      case  1:
 
6925
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_keyfunc);
 
6926
      if (likely(values[1])) kw_args--;
 
6927
      else {
 
6928
        __Pyx_RaiseArgtupleInvalid("groupby_withnull_old", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6929
      }
 
6930
    }
 
6931
    if (unlikely(kw_args > 0)) {
 
6932
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "groupby_withnull_old") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6933
    }
 
6934
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
6935
    __pyx_v_keyfunc = values[1];
 
6936
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
 
6937
    goto __pyx_L5_argtuple_error;
 
6938
  } else {
 
6939
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
6940
    __pyx_v_keyfunc = PyTuple_GET_ITEM(__pyx_args, 1);
 
6941
  }
 
6942
  goto __pyx_L4_argument_unpacking_done;
 
6943
  __pyx_L5_argtuple_error:;
 
6944
  __Pyx_RaiseArgtupleInvalid("groupby_withnull_old", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
6945
  __pyx_L3_error:;
 
6946
  __Pyx_AddTraceback("tseries.groupby_withnull_old");
 
6947
  return NULL;
 
6948
  __pyx_L4_argument_unpacking_done:;
 
6949
  __pyx_v_groups = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
6950
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
6951
  __pyx_v_curKey = Py_None; __Pyx_INCREF(Py_None);
 
6952
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
 
6953
  __pyx_v_members = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
6954
  __pyx_v_bool_mask = Py_None; __Pyx_INCREF(Py_None);
 
6955
  __pyx_v_null_values = Py_None; __Pyx_INCREF(Py_None);
 
6956
  __pyx_bstruct_mapped_index.buf = NULL;
 
6957
  __pyx_bstruct_null_mask.buf = NULL;
 
6958
  __pyx_bstruct_index.buf = NULL;
 
6959
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6960
  {
 
6961
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
6962
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6963
  }
 
6964
  __pyx_bstride_0_index = __pyx_bstruct_index.strides[0];
 
6965
  __pyx_bshape_0_index = __pyx_bstruct_index.shape[0];
 
6966
 
 
6967
  /* "pandas/lib/src/tseries.pyx":761
 
6968
 * def groupby_withnull_old(ndarray[object, ndim = 1] index, object keyfunc):
 
6969
 *     cdef dict groups
 
6970
 *     cdef int length = index.shape[0]             # <<<<<<<<<<<<<<
 
6971
 *     cdef object idx
 
6972
 *     cdef object curKey, key
 
6973
 */
 
6974
  __pyx_v_length = (__pyx_v_index->dimensions[0]);
 
6975
 
 
6976
  /* "pandas/lib/src/tseries.pyx":766
 
6977
 *     cdef list members
 
6978
 * 
 
6979
 *     groups = PyDict_New()             # <<<<<<<<<<<<<<
 
6980
 * 
 
6981
 *     if length != index.shape[0]:
 
6982
 */
 
6983
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6984
  __Pyx_GOTREF(__pyx_t_1);
 
6985
  if (!(likely(PyDict_CheckExact(__pyx_t_1)) || (__pyx_t_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected dict, got %s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
6986
  __Pyx_DECREF(((PyObject *)__pyx_v_groups));
 
6987
  __pyx_v_groups = ((PyObject *)__pyx_t_1);
 
6988
  __pyx_t_1 = 0;
 
6989
 
 
6990
  /* "pandas/lib/src/tseries.pyx":768
 
6991
 *     groups = PyDict_New()
 
6992
 * 
 
6993
 *     if length != index.shape[0]:             # <<<<<<<<<<<<<<
 
6994
 *         raise Exception('Dates and values were not the same length!')
 
6995
 * 
 
6996
 */
 
6997
  __pyx_t_2 = (__pyx_v_length != (__pyx_v_index->dimensions[0]));
 
6998
  if (__pyx_t_2) {
 
6999
 
 
7000
    /* "pandas/lib/src/tseries.pyx":769
 
7001
 * 
 
7002
 *     if length != index.shape[0]:
 
7003
 *         raise Exception('Dates and values were not the same length!')             # <<<<<<<<<<<<<<
 
7004
 * 
 
7005
 *     cdef ndarray[object, ndim=1] mapped_index = arrmap(index, keyfunc)
 
7006
 */
 
7007
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7008
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
7009
    __Pyx_INCREF(__pyx_kp_50);
 
7010
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_50);
 
7011
    __Pyx_GIVEREF(__pyx_kp_50);
 
7012
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7013
    __Pyx_GOTREF(__pyx_t_3);
 
7014
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
7015
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
7016
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7017
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7018
    goto __pyx_L6;
 
7019
  }
 
7020
  __pyx_L6:;
 
7021
 
 
7022
  /* "pandas/lib/src/tseries.pyx":771
 
7023
 *         raise Exception('Dates and values were not the same length!')
 
7024
 * 
 
7025
 *     cdef ndarray[object, ndim=1] mapped_index = arrmap(index, keyfunc)             # <<<<<<<<<<<<<<
 
7026
 * 
 
7027
 *     cdef ndarray[npy_int8, ndim=1] null_mask = _isnullobj(mapped_index)
 
7028
 */
 
7029
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_arrmap); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7030
  __Pyx_GOTREF(__pyx_1);
 
7031
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7032
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
7033
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
 
7034
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_index));
 
7035
  __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
 
7036
  __Pyx_INCREF(__pyx_v_keyfunc);
 
7037
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_keyfunc);
 
7038
  __Pyx_GIVEREF(__pyx_v_keyfunc);
 
7039
  __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7040
  __Pyx_GOTREF(__pyx_t_1);
 
7041
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
7042
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
7043
  if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7044
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
 
7045
  {
 
7046
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
7047
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mapped_index, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
 
7048
      __pyx_v_mapped_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_mapped_index.buf = NULL;
 
7049
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7050
    } else {__pyx_bstride_0_mapped_index = __pyx_bstruct_mapped_index.strides[0];
 
7051
      __pyx_bshape_0_mapped_index = __pyx_bstruct_mapped_index.shape[0];
 
7052
    }
 
7053
  }
 
7054
  __pyx_t_4 = 0;
 
7055
  __pyx_v_mapped_index = ((PyArrayObject *)__pyx_t_1);
 
7056
  __pyx_t_1 = 0;
 
7057
 
 
7058
  /* "pandas/lib/src/tseries.pyx":773
 
7059
 *     cdef ndarray[object, ndim=1] mapped_index = arrmap(index, keyfunc)
 
7060
 * 
 
7061
 *     cdef ndarray[npy_int8, ndim=1] null_mask = _isnullobj(mapped_index)             # <<<<<<<<<<<<<<
 
7062
 * 
 
7063
 *     bool_mask = null_mask.astype(bool)
 
7064
 */
 
7065
  __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__isnullobj(((PyObject *)__pyx_v_mapped_index))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7066
  __Pyx_GOTREF(__pyx_t_1);
 
7067
  {
 
7068
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
7069
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_null_mask, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_npy_int8, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
 
7070
      __pyx_v_null_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_null_mask.buf = NULL;
 
7071
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7072
    } else {__pyx_bstride_0_null_mask = __pyx_bstruct_null_mask.strides[0];
 
7073
      __pyx_bshape_0_null_mask = __pyx_bstruct_null_mask.shape[0];
 
7074
    }
 
7075
  }
 
7076
  __pyx_v_null_mask = ((PyArrayObject *)__pyx_t_1);
 
7077
  __pyx_t_1 = 0;
 
7078
 
 
7079
  /* "pandas/lib/src/tseries.pyx":775
 
7080
 *     cdef ndarray[npy_int8, ndim=1] null_mask = _isnullobj(mapped_index)
 
7081
 * 
 
7082
 *     bool_mask = null_mask.astype(bool)             # <<<<<<<<<<<<<<
 
7083
 * 
 
7084
 *     null_values = np.asarray(index)[bool_mask]
 
7085
 */
 
7086
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_null_mask), __pyx_kp_astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7087
  __Pyx_GOTREF(__pyx_t_1);
 
7088
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7089
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
7090
  __Pyx_INCREF(((PyObject *)((PyObject*)&PyBool_Type)));
 
7091
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyBool_Type)));
 
7092
  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyBool_Type)));
 
7093
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7094
  __Pyx_GOTREF(__pyx_t_5);
 
7095
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
7096
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
7097
  __Pyx_DECREF(__pyx_v_bool_mask);
 
7098
  __pyx_v_bool_mask = __pyx_t_5;
 
7099
  __pyx_t_5 = 0;
 
7100
 
 
7101
  /* "pandas/lib/src/tseries.pyx":777
 
7102
 *     bool_mask = null_mask.astype(bool)
 
7103
 * 
 
7104
 *     null_values = np.asarray(index)[bool_mask]             # <<<<<<<<<<<<<<
 
7105
 * 
 
7106
 *     if null_values.any():
 
7107
 */
 
7108
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7109
  __Pyx_GOTREF(__pyx_1);
 
7110
  __pyx_t_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_asarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7111
  __Pyx_GOTREF(__pyx_t_5);
 
7112
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
7113
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7114
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
7115
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
 
7116
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_index));
 
7117
  __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
 
7118
  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7119
  __Pyx_GOTREF(__pyx_t_1);
 
7120
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
7121
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
7122
  __pyx_1 = PyObject_GetItem(__pyx_t_1, __pyx_v_bool_mask); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7123
  __Pyx_GOTREF(__pyx_1);
 
7124
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
7125
  __Pyx_DECREF(__pyx_v_null_values);
 
7126
  __pyx_v_null_values = __pyx_1;
 
7127
  __pyx_1 = 0;
 
7128
 
 
7129
  /* "pandas/lib/src/tseries.pyx":779
 
7130
 *     null_values = np.asarray(index)[bool_mask]
 
7131
 * 
 
7132
 *     if null_values.any():             # <<<<<<<<<<<<<<
 
7133
 *         PyDict_SetItem(groups, np.NaN, null_values)
 
7134
 * 
 
7135
 */
 
7136
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_null_values, __pyx_kp_any); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7137
  __Pyx_GOTREF(__pyx_t_1);
 
7138
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7139
  __Pyx_GOTREF(__pyx_t_3);
 
7140
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
7141
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7142
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7143
  if (__pyx_t_2) {
 
7144
 
 
7145
    /* "pandas/lib/src/tseries.pyx":780
 
7146
 * 
 
7147
 *     if null_values.any():
 
7148
 *         PyDict_SetItem(groups, np.NaN, null_values)             # <<<<<<<<<<<<<<
 
7149
 * 
 
7150
 *     cdef int i = 0
 
7151
 */
 
7152
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7153
    __Pyx_GOTREF(__pyx_1);
 
7154
    __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7155
    __Pyx_GOTREF(__pyx_t_3);
 
7156
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
7157
    PyDict_SetItem(((PyObject *)__pyx_v_groups), __pyx_t_3, __pyx_v_null_values);
 
7158
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7159
    goto __pyx_L7;
 
7160
  }
 
7161
  __pyx_L7:;
 
7162
 
 
7163
  /* "pandas/lib/src/tseries.pyx":782
 
7164
 *         PyDict_SetItem(groups, np.NaN, null_values)
 
7165
 * 
 
7166
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 
7167
 *     idx = index[0]
 
7168
 *     key = mapped_index[0]
 
7169
 */
 
7170
  __pyx_v_i = 0;
 
7171
 
 
7172
  /* "pandas/lib/src/tseries.pyx":783
 
7173
 * 
 
7174
 *     cdef int i = 0
 
7175
 *     idx = index[0]             # <<<<<<<<<<<<<<
 
7176
 *     key = mapped_index[0]
 
7177
 * 
 
7178
 */
 
7179
  __pyx_t_6 = 0;
 
7180
  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_index;
 
7181
  __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_6, __pyx_bstride_0_index);
 
7182
  __Pyx_INCREF((PyObject*)__pyx_1);
 
7183
  __Pyx_DECREF(__pyx_v_idx);
 
7184
  __pyx_v_idx = __pyx_1;
 
7185
  __pyx_1 = 0;
 
7186
 
 
7187
  /* "pandas/lib/src/tseries.pyx":784
 
7188
 *     cdef int i = 0
 
7189
 *     idx = index[0]
 
7190
 *     key = mapped_index[0]             # <<<<<<<<<<<<<<
 
7191
 * 
 
7192
 *     # Algorithm notes
 
7193
 */
 
7194
  __pyx_t_7 = 0;
 
7195
  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_mapped_index;
 
7196
  __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_7, __pyx_bstride_0_mapped_index);
 
7197
  __Pyx_INCREF((PyObject*)__pyx_1);
 
7198
  __Pyx_DECREF(__pyx_v_key);
 
7199
  __pyx_v_key = __pyx_1;
 
7200
  __pyx_1 = 0;
 
7201
 
 
7202
  /* "pandas/lib/src/tseries.pyx":790
 
7203
 *     #   'lazily' evaluates
 
7204
 * 
 
7205
 *     while i < length:             # <<<<<<<<<<<<<<
 
7206
 *         if not PyDict_Contains(groups, key):
 
7207
 *             members = [idx]
 
7208
 */
 
7209
  while (1) {
 
7210
    __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
7211
    if (!__pyx_t_2) break;
 
7212
 
 
7213
    /* "pandas/lib/src/tseries.pyx":791
 
7214
 * 
 
7215
 *     while i < length:
 
7216
 *         if not PyDict_Contains(groups, key):             # <<<<<<<<<<<<<<
 
7217
 *             members = [idx]
 
7218
 *             PyDict_SetItem(groups, key, members)
 
7219
 */
 
7220
    __pyx_t_2 = (!PyDict_Contains(((PyObject *)__pyx_v_groups), __pyx_v_key));
 
7221
    if (__pyx_t_2) {
 
7222
 
 
7223
      /* "pandas/lib/src/tseries.pyx":792
 
7224
 *     while i < length:
 
7225
 *         if not PyDict_Contains(groups, key):
 
7226
 *             members = [idx]             # <<<<<<<<<<<<<<
 
7227
 *             PyDict_SetItem(groups, key, members)
 
7228
 *             i += 1
 
7229
 */
 
7230
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7231
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
7232
      __Pyx_INCREF(__pyx_v_idx);
 
7233
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_idx);
 
7234
      __Pyx_GIVEREF(__pyx_v_idx);
 
7235
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
7236
      __pyx_v_members = __pyx_t_3;
 
7237
      __pyx_t_3 = 0;
 
7238
 
 
7239
      /* "pandas/lib/src/tseries.pyx":793
 
7240
 *         if not PyDict_Contains(groups, key):
 
7241
 *             members = [idx]
 
7242
 *             PyDict_SetItem(groups, key, members)             # <<<<<<<<<<<<<<
 
7243
 *             i += 1
 
7244
 *             curKey = key
 
7245
 */
 
7246
      PyDict_SetItem(((PyObject *)__pyx_v_groups), __pyx_v_key, ((PyObject *)__pyx_v_members));
 
7247
 
 
7248
      /* "pandas/lib/src/tseries.pyx":794
 
7249
 *             members = [idx]
 
7250
 *             PyDict_SetItem(groups, key, members)
 
7251
 *             i += 1             # <<<<<<<<<<<<<<
 
7252
 *             curKey = key
 
7253
 *             while i < length:
 
7254
 */
 
7255
      __pyx_v_i += 1;
 
7256
 
 
7257
      /* "pandas/lib/src/tseries.pyx":795
 
7258
 *             PyDict_SetItem(groups, key, members)
 
7259
 *             i += 1
 
7260
 *             curKey = key             # <<<<<<<<<<<<<<
 
7261
 *             while i < length:
 
7262
 *                 if null_mask[i]:
 
7263
 */
 
7264
      __Pyx_INCREF(__pyx_v_key);
 
7265
      __Pyx_DECREF(__pyx_v_curKey);
 
7266
      __pyx_v_curKey = __pyx_v_key;
 
7267
 
 
7268
      /* "pandas/lib/src/tseries.pyx":796
 
7269
 *             i += 1
 
7270
 *             curKey = key
 
7271
 *             while i < length:             # <<<<<<<<<<<<<<
 
7272
 *                 if null_mask[i]:
 
7273
 *                     i += 1
 
7274
 */
 
7275
      while (1) {
 
7276
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
7277
        if (!__pyx_t_2) break;
 
7278
 
 
7279
        /* "pandas/lib/src/tseries.pyx":797
 
7280
 *             curKey = key
 
7281
 *             while i < length:
 
7282
 *                 if null_mask[i]:             # <<<<<<<<<<<<<<
 
7283
 *                     i += 1
 
7284
 *                     continue
 
7285
 */
 
7286
        __pyx_t_8 = __pyx_v_i;
 
7287
        if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_null_mask;
 
7288
        __pyx_t_9 = (*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_8, __pyx_bstride_0_null_mask));
 
7289
        if (__pyx_t_9) {
 
7290
 
 
7291
          /* "pandas/lib/src/tseries.pyx":798
 
7292
 *             while i < length:
 
7293
 *                 if null_mask[i]:
 
7294
 *                     i += 1             # <<<<<<<<<<<<<<
 
7295
 *                     continue
 
7296
 * 
 
7297
 */
 
7298
          __pyx_v_i += 1;
 
7299
 
 
7300
          /* "pandas/lib/src/tseries.pyx":799
 
7301
 *                 if null_mask[i]:
 
7302
 *                     i += 1
 
7303
 *                     continue             # <<<<<<<<<<<<<<
 
7304
 * 
 
7305
 *                 idx = index[i]
 
7306
 */
 
7307
          goto __pyx_L11_continue;
 
7308
          goto __pyx_L13;
 
7309
        }
 
7310
        __pyx_L13:;
 
7311
 
 
7312
        /* "pandas/lib/src/tseries.pyx":801
 
7313
 *                     continue
 
7314
 * 
 
7315
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
7316
 *                 key = mapped_index[i]
 
7317
 *                 if key == curKey:
 
7318
 */
 
7319
        __pyx_t_10 = __pyx_v_i;
 
7320
        if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_index;
 
7321
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_10, __pyx_bstride_0_index);
 
7322
        __Pyx_INCREF((PyObject*)__pyx_1);
 
7323
        __Pyx_DECREF(__pyx_v_idx);
 
7324
        __pyx_v_idx = __pyx_1;
 
7325
        __pyx_1 = 0;
 
7326
 
 
7327
        /* "pandas/lib/src/tseries.pyx":802
 
7328
 * 
 
7329
 *                 idx = index[i]
 
7330
 *                 key = mapped_index[i]             # <<<<<<<<<<<<<<
 
7331
 *                 if key == curKey:
 
7332
 *                     members.append(idx)
 
7333
 */
 
7334
        __pyx_t_11 = __pyx_v_i;
 
7335
        if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_mapped_index;
 
7336
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_11, __pyx_bstride_0_mapped_index);
 
7337
        __Pyx_INCREF((PyObject*)__pyx_1);
 
7338
        __Pyx_DECREF(__pyx_v_key);
 
7339
        __pyx_v_key = __pyx_1;
 
7340
        __pyx_1 = 0;
 
7341
 
 
7342
        /* "pandas/lib/src/tseries.pyx":803
 
7343
 *                 idx = index[i]
 
7344
 *                 key = mapped_index[i]
 
7345
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
7346
 *                     members.append(idx)
 
7347
 *                     i += 1
 
7348
 */
 
7349
        __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7350
        __Pyx_GOTREF(__pyx_t_3);
 
7351
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7352
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7353
        if (__pyx_t_2) {
 
7354
 
 
7355
          /* "pandas/lib/src/tseries.pyx":804
 
7356
 *                 key = mapped_index[i]
 
7357
 *                 if key == curKey:
 
7358
 *                     members.append(idx)             # <<<<<<<<<<<<<<
 
7359
 *                     i += 1
 
7360
 *                 else:
 
7361
 */
 
7362
          __pyx_t_12 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7363
 
 
7364
          /* "pandas/lib/src/tseries.pyx":805
 
7365
 *                 if key == curKey:
 
7366
 *                     members.append(idx)
 
7367
 *                     i += 1             # <<<<<<<<<<<<<<
 
7368
 *                 else:
 
7369
 *                     break
 
7370
 */
 
7371
          __pyx_v_i += 1;
 
7372
          goto __pyx_L14;
 
7373
        }
 
7374
        /*else*/ {
 
7375
 
 
7376
          /* "pandas/lib/src/tseries.pyx":807
 
7377
 *                     i += 1
 
7378
 *                 else:
 
7379
 *                     break             # <<<<<<<<<<<<<<
 
7380
 *         else:
 
7381
 *             members = <list> PyDict_GetItem(groups, key)
 
7382
 */
 
7383
          goto __pyx_L12_break;
 
7384
        }
 
7385
        __pyx_L14:;
 
7386
        __pyx_L11_continue:;
 
7387
      }
 
7388
      __pyx_L12_break:;
 
7389
      goto __pyx_L10;
 
7390
    }
 
7391
    /*else*/ {
 
7392
 
 
7393
      /* "pandas/lib/src/tseries.pyx":809
 
7394
 *                     break
 
7395
 *         else:
 
7396
 *             members = <list> PyDict_GetItem(groups, key)             # <<<<<<<<<<<<<<
 
7397
 *             members.append(idx)
 
7398
 *             i += 1
 
7399
 */
 
7400
      __pyx_t_13 = PyDict_GetItem(((PyObject *)__pyx_v_groups), __pyx_v_key);
 
7401
      __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_13)));
 
7402
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
7403
      __pyx_v_members = ((PyObject *)__pyx_t_13);
 
7404
 
 
7405
      /* "pandas/lib/src/tseries.pyx":810
 
7406
 *         else:
 
7407
 *             members = <list> PyDict_GetItem(groups, key)
 
7408
 *             members.append(idx)             # <<<<<<<<<<<<<<
 
7409
 *             i += 1
 
7410
 *             curKey = key
 
7411
 */
 
7412
      __pyx_t_12 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7413
 
 
7414
      /* "pandas/lib/src/tseries.pyx":811
 
7415
 *             members = <list> PyDict_GetItem(groups, key)
 
7416
 *             members.append(idx)
 
7417
 *             i += 1             # <<<<<<<<<<<<<<
 
7418
 *             curKey = key
 
7419
 *             while null_mask[i] and i < length:
 
7420
 */
 
7421
      __pyx_v_i += 1;
 
7422
 
 
7423
      /* "pandas/lib/src/tseries.pyx":812
 
7424
 *             members.append(idx)
 
7425
 *             i += 1
 
7426
 *             curKey = key             # <<<<<<<<<<<<<<
 
7427
 *             while null_mask[i] and i < length:
 
7428
 *                 i += 1
 
7429
 */
 
7430
      __Pyx_INCREF(__pyx_v_key);
 
7431
      __Pyx_DECREF(__pyx_v_curKey);
 
7432
      __pyx_v_curKey = __pyx_v_key;
 
7433
 
 
7434
      /* "pandas/lib/src/tseries.pyx":813
 
7435
 *             i += 1
 
7436
 *             curKey = key
 
7437
 *             while null_mask[i] and i < length:             # <<<<<<<<<<<<<<
 
7438
 *                 i += 1
 
7439
 * 
 
7440
 */
 
7441
      while (1) {
 
7442
        __pyx_t_12 = __pyx_v_i;
 
7443
        if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_null_mask;
 
7444
        if ((*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_12, __pyx_bstride_0_null_mask))) {
 
7445
          __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
7446
        } else {
 
7447
          __pyx_t_2 = (*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_12, __pyx_bstride_0_null_mask));
 
7448
        }
 
7449
        if (!__pyx_t_2) break;
 
7450
 
 
7451
        /* "pandas/lib/src/tseries.pyx":814
 
7452
 *             curKey = key
 
7453
 *             while null_mask[i] and i < length:
 
7454
 *                 i += 1             # <<<<<<<<<<<<<<
 
7455
 * 
 
7456
 *             while i < length:
 
7457
 */
 
7458
        __pyx_v_i += 1;
 
7459
      }
 
7460
 
 
7461
      /* "pandas/lib/src/tseries.pyx":816
 
7462
 *                 i += 1
 
7463
 * 
 
7464
 *             while i < length:             # <<<<<<<<<<<<<<
 
7465
 *                 if null_mask[i]:
 
7466
 *                     i += 1
 
7467
 */
 
7468
      while (1) {
 
7469
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
7470
        if (!__pyx_t_2) break;
 
7471
 
 
7472
        /* "pandas/lib/src/tseries.pyx":817
 
7473
 * 
 
7474
 *             while i < length:
 
7475
 *                 if null_mask[i]:             # <<<<<<<<<<<<<<
 
7476
 *                     i += 1
 
7477
 *                     continue
 
7478
 */
 
7479
        __pyx_t_14 = __pyx_v_i;
 
7480
        if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_null_mask;
 
7481
        __pyx_t_9 = (*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_14, __pyx_bstride_0_null_mask));
 
7482
        if (__pyx_t_9) {
 
7483
 
 
7484
          /* "pandas/lib/src/tseries.pyx":818
 
7485
 *             while i < length:
 
7486
 *                 if null_mask[i]:
 
7487
 *                     i += 1             # <<<<<<<<<<<<<<
 
7488
 *                     continue
 
7489
 * 
 
7490
 */
 
7491
          __pyx_v_i += 1;
 
7492
 
 
7493
          /* "pandas/lib/src/tseries.pyx":819
 
7494
 *                 if null_mask[i]:
 
7495
 *                     i += 1
 
7496
 *                     continue             # <<<<<<<<<<<<<<
 
7497
 * 
 
7498
 *                 idx = index[i]
 
7499
 */
 
7500
          goto __pyx_L17_continue;
 
7501
          goto __pyx_L19;
 
7502
        }
 
7503
        __pyx_L19:;
 
7504
 
 
7505
        /* "pandas/lib/src/tseries.pyx":821
 
7506
 *                     continue
 
7507
 * 
 
7508
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
7509
 *                 key = mapped_index[i]
 
7510
 *                 if key == curKey:
 
7511
 */
 
7512
        __pyx_t_15 = __pyx_v_i;
 
7513
        if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_index;
 
7514
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_15, __pyx_bstride_0_index);
 
7515
        __Pyx_INCREF((PyObject*)__pyx_1);
 
7516
        __Pyx_DECREF(__pyx_v_idx);
 
7517
        __pyx_v_idx = __pyx_1;
 
7518
        __pyx_1 = 0;
 
7519
 
 
7520
        /* "pandas/lib/src/tseries.pyx":822
 
7521
 * 
 
7522
 *                 idx = index[i]
 
7523
 *                 key = mapped_index[i]             # <<<<<<<<<<<<<<
 
7524
 *                 if key == curKey:
 
7525
 *                     members.append(idx)
 
7526
 */
 
7527
        __pyx_t_16 = __pyx_v_i;
 
7528
        if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_mapped_index;
 
7529
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_16, __pyx_bstride_0_mapped_index);
 
7530
        __Pyx_INCREF((PyObject*)__pyx_1);
 
7531
        __Pyx_DECREF(__pyx_v_key);
 
7532
        __pyx_v_key = __pyx_1;
 
7533
        __pyx_1 = 0;
 
7534
 
 
7535
        /* "pandas/lib/src/tseries.pyx":823
 
7536
 *                 idx = index[i]
 
7537
 *                 key = mapped_index[i]
 
7538
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
7539
 *                     members.append(idx)
 
7540
 *                     i += 1
 
7541
 */
 
7542
        __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7543
        __Pyx_GOTREF(__pyx_t_3);
 
7544
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7545
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7546
        if (__pyx_t_2) {
 
7547
 
 
7548
          /* "pandas/lib/src/tseries.pyx":824
 
7549
 *                 key = mapped_index[i]
 
7550
 *                 if key == curKey:
 
7551
 *                     members.append(idx)             # <<<<<<<<<<<<<<
 
7552
 *                     i += 1
 
7553
 *                 else:
 
7554
 */
 
7555
          __pyx_t_17 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7556
 
 
7557
          /* "pandas/lib/src/tseries.pyx":825
 
7558
 *                 if key == curKey:
 
7559
 *                     members.append(idx)
 
7560
 *                     i += 1             # <<<<<<<<<<<<<<
 
7561
 *                 else:
 
7562
 *                     break
 
7563
 */
 
7564
          __pyx_v_i += 1;
 
7565
          goto __pyx_L20;
 
7566
        }
 
7567
        /*else*/ {
 
7568
 
 
7569
          /* "pandas/lib/src/tseries.pyx":827
 
7570
 *                     i += 1
 
7571
 *                 else:
 
7572
 *                     break             # <<<<<<<<<<<<<<
 
7573
 * 
 
7574
 *     return groups
 
7575
 */
 
7576
          goto __pyx_L18_break;
 
7577
        }
 
7578
        __pyx_L20:;
 
7579
        __pyx_L17_continue:;
 
7580
      }
 
7581
      __pyx_L18_break:;
 
7582
    }
 
7583
    __pyx_L10:;
 
7584
  }
 
7585
 
 
7586
  /* "pandas/lib/src/tseries.pyx":829
 
7587
 *                     break
 
7588
 * 
 
7589
 *     return groups             # <<<<<<<<<<<<<<
 
7590
 * 
 
7591
 * @cython.boundscheck(False)
 
7592
 */
 
7593
  __Pyx_XDECREF(__pyx_r);
 
7594
  __Pyx_INCREF(((PyObject *)__pyx_v_groups));
 
7595
  __pyx_r = ((PyObject *)__pyx_v_groups);
 
7596
  goto __pyx_L0;
 
7597
 
 
7598
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
7599
  goto __pyx_L0;
 
7600
  __pyx_L1_error:;
 
7601
  __Pyx_XDECREF(__pyx_1);
 
7602
  __Pyx_XDECREF(__pyx_t_1);
 
7603
  __Pyx_XDECREF(__pyx_t_3);
 
7604
  __Pyx_XDECREF(__pyx_t_5);
 
7605
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
7606
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
7607
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
7608
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_null_mask);
 
7609
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
 
7610
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
7611
  __Pyx_AddTraceback("tseries.groupby_withnull_old");
 
7612
  __pyx_r = NULL;
 
7613
  goto __pyx_L2;
 
7614
  __pyx_L0:;
 
7615
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
7616
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_null_mask);
 
7617
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
 
7618
  __pyx_L2:;
 
7619
  __Pyx_DECREF(__pyx_v_groups);
 
7620
  __Pyx_DECREF(__pyx_v_idx);
 
7621
  __Pyx_DECREF(__pyx_v_curKey);
 
7622
  __Pyx_DECREF(__pyx_v_key);
 
7623
  __Pyx_DECREF(__pyx_v_members);
 
7624
  __Pyx_XDECREF((PyObject *)__pyx_v_mapped_index);
 
7625
  __Pyx_XDECREF((PyObject *)__pyx_v_null_mask);
 
7626
  __Pyx_DECREF(__pyx_v_bool_mask);
 
7627
  __Pyx_DECREF(__pyx_v_null_values);
 
7628
  __Pyx_XGIVEREF(__pyx_r);
 
7629
  __Pyx_FinishRefcountContext();
 
7630
  return __pyx_r;
 
7631
}
 
7632
 
 
7633
/* "pandas/lib/src/tseries.pyx":832
 
7634
 * 
 
7635
 * @cython.boundscheck(False)
 
7636
 * def groupby_withnull(ndarray[object, ndim = 1] index, object keyfunc):             # <<<<<<<<<<<<<<
 
7637
 *     cdef dict groups
 
7638
 *     cdef int length = index.shape[0]
 
7639
 */
 
7640
 
 
7641
static PyObject *__pyx_pf_7tseries_groupby_withnull(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
7642
static PyObject *__pyx_pf_7tseries_groupby_withnull(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
7643
  PyArrayObject *__pyx_v_index = 0;
 
7644
  PyObject *__pyx_v_keyfunc = 0;
 
7645
  PyObject *__pyx_v_groups;
 
7646
  int __pyx_v_length;
 
7647
  PyObject *__pyx_v_idx;
 
7648
  PyObject *__pyx_v_curKey;
 
7649
  PyObject *__pyx_v_key;
 
7650
  PyObject *__pyx_v_members;
 
7651
  PyArrayObject *__pyx_v_mapped_index = 0;
 
7652
  PyArrayObject *__pyx_v_null_mask = 0;
 
7653
  PyObject *__pyx_v_bool_mask;
 
7654
  PyObject *__pyx_v_null_values;
 
7655
  int __pyx_v_i;
 
7656
  Py_buffer __pyx_bstruct_index;
 
7657
  Py_ssize_t __pyx_bstride_0_index = 0;
 
7658
  Py_ssize_t __pyx_bshape_0_index = 0;
 
7659
  Py_buffer __pyx_bstruct_null_mask;
 
7660
  Py_ssize_t __pyx_bstride_0_null_mask = 0;
 
7661
  Py_ssize_t __pyx_bshape_0_null_mask = 0;
 
7662
  Py_buffer __pyx_bstruct_mapped_index;
 
7663
  Py_ssize_t __pyx_bstride_0_mapped_index = 0;
 
7664
  Py_ssize_t __pyx_bshape_0_mapped_index = 0;
 
7665
  PyObject *__pyx_r = NULL;
 
7666
  PyObject *__pyx_1 = 0;
 
7667
  PyObject *__pyx_t_1 = NULL;
 
7668
  int __pyx_t_2;
 
7669
  PyObject *__pyx_t_3 = NULL;
 
7670
  PyArrayObject *__pyx_t_4 = NULL;
 
7671
  PyObject *__pyx_t_5 = NULL;
 
7672
  long __pyx_t_6;
 
7673
  long __pyx_t_7;
 
7674
  int __pyx_t_8;
 
7675
  npy_int8 __pyx_t_9;
 
7676
  int __pyx_t_10;
 
7677
  int __pyx_t_11;
 
7678
  int __pyx_t_12;
 
7679
  int __pyx_t_13;
 
7680
  int __pyx_t_14;
 
7681
  int __pyx_t_15;
 
7682
  int __pyx_t_16;
 
7683
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_keyfunc,0};
 
7684
  __Pyx_SetupRefcountContext("groupby_withnull");
 
7685
  __pyx_self = __pyx_self;
 
7686
  if (unlikely(__pyx_kwds)) {
 
7687
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
7688
    PyObject* values[2] = {0,0};
 
7689
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
7690
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
7691
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
7692
      case  0: break;
 
7693
      default: goto __pyx_L5_argtuple_error;
 
7694
    }
 
7695
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
7696
      case  0:
 
7697
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
7698
      if (likely(values[0])) kw_args--;
 
7699
      else goto __pyx_L5_argtuple_error;
 
7700
      case  1:
 
7701
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_keyfunc);
 
7702
      if (likely(values[1])) kw_args--;
 
7703
      else {
 
7704
        __Pyx_RaiseArgtupleInvalid("groupby_withnull", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
7705
      }
 
7706
    }
 
7707
    if (unlikely(kw_args > 0)) {
 
7708
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "groupby_withnull") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
7709
    }
 
7710
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
7711
    __pyx_v_keyfunc = values[1];
 
7712
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
 
7713
    goto __pyx_L5_argtuple_error;
 
7714
  } else {
 
7715
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
7716
    __pyx_v_keyfunc = PyTuple_GET_ITEM(__pyx_args, 1);
 
7717
  }
 
7718
  goto __pyx_L4_argument_unpacking_done;
 
7719
  __pyx_L5_argtuple_error:;
 
7720
  __Pyx_RaiseArgtupleInvalid("groupby_withnull", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
7721
  __pyx_L3_error:;
 
7722
  __Pyx_AddTraceback("tseries.groupby_withnull");
 
7723
  return NULL;
 
7724
  __pyx_L4_argument_unpacking_done:;
 
7725
  __pyx_v_groups = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
7726
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
7727
  __pyx_v_curKey = Py_None; __Pyx_INCREF(Py_None);
 
7728
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
 
7729
  __pyx_v_members = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
7730
  __pyx_v_bool_mask = Py_None; __Pyx_INCREF(Py_None);
 
7731
  __pyx_v_null_values = Py_None; __Pyx_INCREF(Py_None);
 
7732
  __pyx_bstruct_mapped_index.buf = NULL;
 
7733
  __pyx_bstruct_null_mask.buf = NULL;
 
7734
  __pyx_bstruct_index.buf = NULL;
 
7735
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7736
  {
 
7737
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
7738
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7739
  }
 
7740
  __pyx_bstride_0_index = __pyx_bstruct_index.strides[0];
 
7741
  __pyx_bshape_0_index = __pyx_bstruct_index.shape[0];
 
7742
 
 
7743
  /* "pandas/lib/src/tseries.pyx":834
 
7744
 * def groupby_withnull(ndarray[object, ndim = 1] index, object keyfunc):
 
7745
 *     cdef dict groups
 
7746
 *     cdef int length = index.shape[0]             # <<<<<<<<<<<<<<
 
7747
 *     cdef object idx
 
7748
 *     cdef object curKey, key
 
7749
 */
 
7750
  __pyx_v_length = (__pyx_v_index->dimensions[0]);
 
7751
 
 
7752
  /* "pandas/lib/src/tseries.pyx":839
 
7753
 *     cdef list members
 
7754
 * 
 
7755
 *     groups = PyDict_New()             # <<<<<<<<<<<<<<
 
7756
 * 
 
7757
 *     if length != index.shape[0]:
 
7758
 */
 
7759
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7760
  __Pyx_GOTREF(__pyx_t_1);
 
7761
  if (!(likely(PyDict_CheckExact(__pyx_t_1)) || (__pyx_t_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected dict, got %s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7762
  __Pyx_DECREF(((PyObject *)__pyx_v_groups));
 
7763
  __pyx_v_groups = ((PyObject *)__pyx_t_1);
 
7764
  __pyx_t_1 = 0;
 
7765
 
 
7766
  /* "pandas/lib/src/tseries.pyx":841
 
7767
 *     groups = PyDict_New()
 
7768
 * 
 
7769
 *     if length != index.shape[0]:             # <<<<<<<<<<<<<<
 
7770
 *         raise Exception('Dates and values were not the same length!')
 
7771
 * 
 
7772
 */
 
7773
  __pyx_t_2 = (__pyx_v_length != (__pyx_v_index->dimensions[0]));
 
7774
  if (__pyx_t_2) {
 
7775
 
 
7776
    /* "pandas/lib/src/tseries.pyx":842
 
7777
 * 
 
7778
 *     if length != index.shape[0]:
 
7779
 *         raise Exception('Dates and values were not the same length!')             # <<<<<<<<<<<<<<
 
7780
 * 
 
7781
 *     cdef ndarray[object, ndim=1] mapped_index = arrmap(index, keyfunc)
 
7782
 */
 
7783
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7784
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
7785
    __Pyx_INCREF(__pyx_kp_51);
 
7786
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_51);
 
7787
    __Pyx_GIVEREF(__pyx_kp_51);
 
7788
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7789
    __Pyx_GOTREF(__pyx_t_3);
 
7790
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
7791
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
7792
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7793
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7794
    goto __pyx_L6;
 
7795
  }
 
7796
  __pyx_L6:;
 
7797
 
 
7798
  /* "pandas/lib/src/tseries.pyx":844
 
7799
 *         raise Exception('Dates and values were not the same length!')
 
7800
 * 
 
7801
 *     cdef ndarray[object, ndim=1] mapped_index = arrmap(index, keyfunc)             # <<<<<<<<<<<<<<
 
7802
 * 
 
7803
 *     cdef ndarray[npy_int8, ndim=1] null_mask = _isnullobj(mapped_index)
 
7804
 */
 
7805
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_arrmap); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7806
  __Pyx_GOTREF(__pyx_1);
 
7807
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7808
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
7809
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
 
7810
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_index));
 
7811
  __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
 
7812
  __Pyx_INCREF(__pyx_v_keyfunc);
 
7813
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_keyfunc);
 
7814
  __Pyx_GIVEREF(__pyx_v_keyfunc);
 
7815
  __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7816
  __Pyx_GOTREF(__pyx_t_1);
 
7817
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
7818
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
7819
  if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7820
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
 
7821
  {
 
7822
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
7823
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mapped_index, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
 
7824
      __pyx_v_mapped_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_mapped_index.buf = NULL;
 
7825
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7826
    } else {__pyx_bstride_0_mapped_index = __pyx_bstruct_mapped_index.strides[0];
 
7827
      __pyx_bshape_0_mapped_index = __pyx_bstruct_mapped_index.shape[0];
 
7828
    }
 
7829
  }
 
7830
  __pyx_t_4 = 0;
 
7831
  __pyx_v_mapped_index = ((PyArrayObject *)__pyx_t_1);
 
7832
  __pyx_t_1 = 0;
 
7833
 
 
7834
  /* "pandas/lib/src/tseries.pyx":846
 
7835
 *     cdef ndarray[object, ndim=1] mapped_index = arrmap(index, keyfunc)
 
7836
 * 
 
7837
 *     cdef ndarray[npy_int8, ndim=1] null_mask = _isnullobj(mapped_index)             # <<<<<<<<<<<<<<
 
7838
 * 
 
7839
 *     bool_mask = null_mask.astype(bool)
 
7840
 */
 
7841
  __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__isnullobj(((PyObject *)__pyx_v_mapped_index))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7842
  __Pyx_GOTREF(__pyx_t_1);
 
7843
  {
 
7844
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
7845
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_null_mask, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_npy_int8, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
 
7846
      __pyx_v_null_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_null_mask.buf = NULL;
 
7847
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7848
    } else {__pyx_bstride_0_null_mask = __pyx_bstruct_null_mask.strides[0];
 
7849
      __pyx_bshape_0_null_mask = __pyx_bstruct_null_mask.shape[0];
 
7850
    }
 
7851
  }
 
7852
  __pyx_v_null_mask = ((PyArrayObject *)__pyx_t_1);
 
7853
  __pyx_t_1 = 0;
 
7854
 
 
7855
  /* "pandas/lib/src/tseries.pyx":848
 
7856
 *     cdef ndarray[npy_int8, ndim=1] null_mask = _isnullobj(mapped_index)
 
7857
 * 
 
7858
 *     bool_mask = null_mask.astype(bool)             # <<<<<<<<<<<<<<
 
7859
 * 
 
7860
 *     null_values = np.asarray(index)[bool_mask]
 
7861
 */
 
7862
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_null_mask), __pyx_kp_astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7863
  __Pyx_GOTREF(__pyx_t_1);
 
7864
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7865
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
7866
  __Pyx_INCREF(((PyObject *)((PyObject*)&PyBool_Type)));
 
7867
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyBool_Type)));
 
7868
  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyBool_Type)));
 
7869
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7870
  __Pyx_GOTREF(__pyx_t_5);
 
7871
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
7872
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
7873
  __Pyx_DECREF(__pyx_v_bool_mask);
 
7874
  __pyx_v_bool_mask = __pyx_t_5;
 
7875
  __pyx_t_5 = 0;
 
7876
 
 
7877
  /* "pandas/lib/src/tseries.pyx":850
 
7878
 *     bool_mask = null_mask.astype(bool)
 
7879
 * 
 
7880
 *     null_values = np.asarray(index)[bool_mask]             # <<<<<<<<<<<<<<
 
7881
 * 
 
7882
 *     if null_values.any():
 
7883
 */
 
7884
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7885
  __Pyx_GOTREF(__pyx_1);
 
7886
  __pyx_t_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_asarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7887
  __Pyx_GOTREF(__pyx_t_5);
 
7888
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
7889
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7890
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
7891
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
 
7892
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_index));
 
7893
  __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
 
7894
  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7895
  __Pyx_GOTREF(__pyx_t_1);
 
7896
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
7897
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
7898
  __pyx_1 = PyObject_GetItem(__pyx_t_1, __pyx_v_bool_mask); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7899
  __Pyx_GOTREF(__pyx_1);
 
7900
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
7901
  __Pyx_DECREF(__pyx_v_null_values);
 
7902
  __pyx_v_null_values = __pyx_1;
 
7903
  __pyx_1 = 0;
 
7904
 
 
7905
  /* "pandas/lib/src/tseries.pyx":852
 
7906
 *     null_values = np.asarray(index)[bool_mask]
 
7907
 * 
 
7908
 *     if null_values.any():             # <<<<<<<<<<<<<<
 
7909
 *         PyDict_SetItem(groups, np.NaN, null_values)
 
7910
 * 
 
7911
 */
 
7912
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_null_values, __pyx_kp_any); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7913
  __Pyx_GOTREF(__pyx_t_1);
 
7914
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7915
  __Pyx_GOTREF(__pyx_t_3);
 
7916
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
7917
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7918
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7919
  if (__pyx_t_2) {
 
7920
 
 
7921
    /* "pandas/lib/src/tseries.pyx":853
 
7922
 * 
 
7923
 *     if null_values.any():
 
7924
 *         PyDict_SetItem(groups, np.NaN, null_values)             # <<<<<<<<<<<<<<
 
7925
 * 
 
7926
 *     cdef int i = 0
 
7927
 */
 
7928
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7929
    __Pyx_GOTREF(__pyx_1);
 
7930
    __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7931
    __Pyx_GOTREF(__pyx_t_3);
 
7932
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
7933
    PyDict_SetItem(((PyObject *)__pyx_v_groups), __pyx_t_3, __pyx_v_null_values);
 
7934
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
7935
    goto __pyx_L7;
 
7936
  }
 
7937
  __pyx_L7:;
 
7938
 
 
7939
  /* "pandas/lib/src/tseries.pyx":855
 
7940
 *         PyDict_SetItem(groups, np.NaN, null_values)
 
7941
 * 
 
7942
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 
7943
 *     idx = index[0]
 
7944
 *     key = mapped_index[0]
 
7945
 */
 
7946
  __pyx_v_i = 0;
 
7947
 
 
7948
  /* "pandas/lib/src/tseries.pyx":856
 
7949
 * 
 
7950
 *     cdef int i = 0
 
7951
 *     idx = index[0]             # <<<<<<<<<<<<<<
 
7952
 *     key = mapped_index[0]
 
7953
 * 
 
7954
 */
 
7955
  __pyx_t_6 = 0;
 
7956
  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_index;
 
7957
  __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_6, __pyx_bstride_0_index);
 
7958
  __Pyx_INCREF((PyObject*)__pyx_1);
 
7959
  __Pyx_DECREF(__pyx_v_idx);
 
7960
  __pyx_v_idx = __pyx_1;
 
7961
  __pyx_1 = 0;
 
7962
 
 
7963
  /* "pandas/lib/src/tseries.pyx":857
 
7964
 *     cdef int i = 0
 
7965
 *     idx = index[0]
 
7966
 *     key = mapped_index[0]             # <<<<<<<<<<<<<<
 
7967
 * 
 
7968
 *     # Algorithm notes
 
7969
 */
 
7970
  __pyx_t_7 = 0;
 
7971
  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_mapped_index;
 
7972
  __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_7, __pyx_bstride_0_mapped_index);
 
7973
  __Pyx_INCREF((PyObject*)__pyx_1);
 
7974
  __Pyx_DECREF(__pyx_v_key);
 
7975
  __pyx_v_key = __pyx_1;
 
7976
  __pyx_1 = 0;
 
7977
 
 
7978
  /* "pandas/lib/src/tseries.pyx":863
 
7979
 *     #   'lazily' evaluates
 
7980
 * 
 
7981
 *     while i < length:             # <<<<<<<<<<<<<<
 
7982
 *         if key not in groups:
 
7983
 *             members = [idx]
 
7984
 */
 
7985
  while (1) {
 
7986
    __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
7987
    if (!__pyx_t_2) break;
 
7988
 
 
7989
    /* "pandas/lib/src/tseries.pyx":864
 
7990
 * 
 
7991
 *     while i < length:
 
7992
 *         if key not in groups:             # <<<<<<<<<<<<<<
 
7993
 *             members = [idx]
 
7994
 *             groups[key] = members
 
7995
 */
 
7996
    __pyx_t_2 = (!PySequence_Contains(((PyObject *)__pyx_v_groups), __pyx_v_key)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
7997
    if (__pyx_t_2) {
 
7998
 
 
7999
      /* "pandas/lib/src/tseries.pyx":865
 
8000
 *     while i < length:
 
8001
 *         if key not in groups:
 
8002
 *             members = [idx]             # <<<<<<<<<<<<<<
 
8003
 *             groups[key] = members
 
8004
 *             i += 1
 
8005
 */
 
8006
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8007
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
8008
      __Pyx_INCREF(__pyx_v_idx);
 
8009
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_idx);
 
8010
      __Pyx_GIVEREF(__pyx_v_idx);
 
8011
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
8012
      __pyx_v_members = __pyx_t_3;
 
8013
      __pyx_t_3 = 0;
 
8014
 
 
8015
      /* "pandas/lib/src/tseries.pyx":866
 
8016
 *         if key not in groups:
 
8017
 *             members = [idx]
 
8018
 *             groups[key] = members             # <<<<<<<<<<<<<<
 
8019
 *             i += 1
 
8020
 *             curKey = key
 
8021
 */
 
8022
      if (PyDict_SetItem(((PyObject *)__pyx_v_groups), __pyx_v_key, ((PyObject *)__pyx_v_members)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8023
 
 
8024
      /* "pandas/lib/src/tseries.pyx":867
 
8025
 *             members = [idx]
 
8026
 *             groups[key] = members
 
8027
 *             i += 1             # <<<<<<<<<<<<<<
 
8028
 *             curKey = key
 
8029
 *             while i < length:
 
8030
 */
 
8031
      __pyx_v_i += 1;
 
8032
 
 
8033
      /* "pandas/lib/src/tseries.pyx":868
 
8034
 *             groups[key] = members
 
8035
 *             i += 1
 
8036
 *             curKey = key             # <<<<<<<<<<<<<<
 
8037
 *             while i < length:
 
8038
 *                 if null_mask[i]:
 
8039
 */
 
8040
      __Pyx_INCREF(__pyx_v_key);
 
8041
      __Pyx_DECREF(__pyx_v_curKey);
 
8042
      __pyx_v_curKey = __pyx_v_key;
 
8043
 
 
8044
      /* "pandas/lib/src/tseries.pyx":869
 
8045
 *             i += 1
 
8046
 *             curKey = key
 
8047
 *             while i < length:             # <<<<<<<<<<<<<<
 
8048
 *                 if null_mask[i]:
 
8049
 *                     i += 1
 
8050
 */
 
8051
      while (1) {
 
8052
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
8053
        if (!__pyx_t_2) break;
 
8054
 
 
8055
        /* "pandas/lib/src/tseries.pyx":870
 
8056
 *             curKey = key
 
8057
 *             while i < length:
 
8058
 *                 if null_mask[i]:             # <<<<<<<<<<<<<<
 
8059
 *                     i += 1
 
8060
 *                     continue
 
8061
 */
 
8062
        __pyx_t_8 = __pyx_v_i;
 
8063
        if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_null_mask;
 
8064
        __pyx_t_9 = (*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_8, __pyx_bstride_0_null_mask));
 
8065
        if (__pyx_t_9) {
 
8066
 
 
8067
          /* "pandas/lib/src/tseries.pyx":871
 
8068
 *             while i < length:
 
8069
 *                 if null_mask[i]:
 
8070
 *                     i += 1             # <<<<<<<<<<<<<<
 
8071
 *                     continue
 
8072
 * 
 
8073
 */
 
8074
          __pyx_v_i += 1;
 
8075
 
 
8076
          /* "pandas/lib/src/tseries.pyx":872
 
8077
 *                 if null_mask[i]:
 
8078
 *                     i += 1
 
8079
 *                     continue             # <<<<<<<<<<<<<<
 
8080
 * 
 
8081
 *                 idx = index[i]
 
8082
 */
 
8083
          goto __pyx_L11_continue;
 
8084
          goto __pyx_L13;
 
8085
        }
 
8086
        __pyx_L13:;
 
8087
 
 
8088
        /* "pandas/lib/src/tseries.pyx":874
 
8089
 *                     continue
 
8090
 * 
 
8091
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
8092
 *                 key = mapped_index[i]
 
8093
 *                 if key == curKey:
 
8094
 */
 
8095
        __pyx_t_10 = __pyx_v_i;
 
8096
        if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_index;
 
8097
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_10, __pyx_bstride_0_index);
 
8098
        __Pyx_INCREF((PyObject*)__pyx_1);
 
8099
        __Pyx_DECREF(__pyx_v_idx);
 
8100
        __pyx_v_idx = __pyx_1;
 
8101
        __pyx_1 = 0;
 
8102
 
 
8103
        /* "pandas/lib/src/tseries.pyx":875
 
8104
 * 
 
8105
 *                 idx = index[i]
 
8106
 *                 key = mapped_index[i]             # <<<<<<<<<<<<<<
 
8107
 *                 if key == curKey:
 
8108
 *                     members.append(idx)
 
8109
 */
 
8110
        __pyx_t_11 = __pyx_v_i;
 
8111
        if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_mapped_index;
 
8112
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_11, __pyx_bstride_0_mapped_index);
 
8113
        __Pyx_INCREF((PyObject*)__pyx_1);
 
8114
        __Pyx_DECREF(__pyx_v_key);
 
8115
        __pyx_v_key = __pyx_1;
 
8116
        __pyx_1 = 0;
 
8117
 
 
8118
        /* "pandas/lib/src/tseries.pyx":876
 
8119
 *                 idx = index[i]
 
8120
 *                 key = mapped_index[i]
 
8121
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
8122
 *                     members.append(idx)
 
8123
 *                     i += 1
 
8124
 */
 
8125
        __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8126
        __Pyx_GOTREF(__pyx_t_3);
 
8127
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8128
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
8129
        if (__pyx_t_2) {
 
8130
 
 
8131
          /* "pandas/lib/src/tseries.pyx":877
 
8132
 *                 key = mapped_index[i]
 
8133
 *                 if key == curKey:
 
8134
 *                     members.append(idx)             # <<<<<<<<<<<<<<
 
8135
 *                     i += 1
 
8136
 *                 else:
 
8137
 */
 
8138
          __pyx_t_12 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8139
 
 
8140
          /* "pandas/lib/src/tseries.pyx":878
 
8141
 *                 if key == curKey:
 
8142
 *                     members.append(idx)
 
8143
 *                     i += 1             # <<<<<<<<<<<<<<
 
8144
 *                 else:
 
8145
 *                     break
 
8146
 */
 
8147
          __pyx_v_i += 1;
 
8148
          goto __pyx_L14;
 
8149
        }
 
8150
        /*else*/ {
 
8151
 
 
8152
          /* "pandas/lib/src/tseries.pyx":880
 
8153
 *                     i += 1
 
8154
 *                 else:
 
8155
 *                     break             # <<<<<<<<<<<<<<
 
8156
 *         else:
 
8157
 *             members = <list> groups[key]
 
8158
 */
 
8159
          goto __pyx_L12_break;
 
8160
        }
 
8161
        __pyx_L14:;
 
8162
        __pyx_L11_continue:;
 
8163
      }
 
8164
      __pyx_L12_break:;
 
8165
      goto __pyx_L10;
 
8166
    }
 
8167
    /*else*/ {
 
8168
 
 
8169
      /* "pandas/lib/src/tseries.pyx":882
 
8170
 *                     break
 
8171
 *         else:
 
8172
 *             members = <list> groups[key]             # <<<<<<<<<<<<<<
 
8173
 *             members.append(idx)
 
8174
 *             i += 1
 
8175
 */
 
8176
      __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_groups), __pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8177
      __Pyx_GOTREF(__pyx_1);
 
8178
      __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_1)));
 
8179
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
8180
      __pyx_v_members = ((PyObject *)__pyx_1);
 
8181
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
8182
 
 
8183
      /* "pandas/lib/src/tseries.pyx":883
 
8184
 *         else:
 
8185
 *             members = <list> groups[key]
 
8186
 *             members.append(idx)             # <<<<<<<<<<<<<<
 
8187
 *             i += 1
 
8188
 *             curKey = key
 
8189
 */
 
8190
      __pyx_t_12 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8191
 
 
8192
      /* "pandas/lib/src/tseries.pyx":884
 
8193
 *             members = <list> groups[key]
 
8194
 *             members.append(idx)
 
8195
 *             i += 1             # <<<<<<<<<<<<<<
 
8196
 *             curKey = key
 
8197
 *             while null_mask[i] and i < length:
 
8198
 */
 
8199
      __pyx_v_i += 1;
 
8200
 
 
8201
      /* "pandas/lib/src/tseries.pyx":885
 
8202
 *             members.append(idx)
 
8203
 *             i += 1
 
8204
 *             curKey = key             # <<<<<<<<<<<<<<
 
8205
 *             while null_mask[i] and i < length:
 
8206
 *                 i += 1
 
8207
 */
 
8208
      __Pyx_INCREF(__pyx_v_key);
 
8209
      __Pyx_DECREF(__pyx_v_curKey);
 
8210
      __pyx_v_curKey = __pyx_v_key;
 
8211
 
 
8212
      /* "pandas/lib/src/tseries.pyx":886
 
8213
 *             i += 1
 
8214
 *             curKey = key
 
8215
 *             while null_mask[i] and i < length:             # <<<<<<<<<<<<<<
 
8216
 *                 i += 1
 
8217
 * 
 
8218
 */
 
8219
      while (1) {
 
8220
        __pyx_t_12 = __pyx_v_i;
 
8221
        if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_null_mask;
 
8222
        if ((*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_12, __pyx_bstride_0_null_mask))) {
 
8223
          __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
8224
        } else {
 
8225
          __pyx_t_2 = (*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_12, __pyx_bstride_0_null_mask));
 
8226
        }
 
8227
        if (!__pyx_t_2) break;
 
8228
 
 
8229
        /* "pandas/lib/src/tseries.pyx":887
 
8230
 *             curKey = key
 
8231
 *             while null_mask[i] and i < length:
 
8232
 *                 i += 1             # <<<<<<<<<<<<<<
 
8233
 * 
 
8234
 *             while i < length:
 
8235
 */
 
8236
        __pyx_v_i += 1;
 
8237
      }
 
8238
 
 
8239
      /* "pandas/lib/src/tseries.pyx":889
 
8240
 *                 i += 1
 
8241
 * 
 
8242
 *             while i < length:             # <<<<<<<<<<<<<<
 
8243
 *                 if null_mask[i]:
 
8244
 *                     i += 1
 
8245
 */
 
8246
      while (1) {
 
8247
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
8248
        if (!__pyx_t_2) break;
 
8249
 
 
8250
        /* "pandas/lib/src/tseries.pyx":890
 
8251
 * 
 
8252
 *             while i < length:
 
8253
 *                 if null_mask[i]:             # <<<<<<<<<<<<<<
 
8254
 *                     i += 1
 
8255
 *                     continue
 
8256
 */
 
8257
        __pyx_t_13 = __pyx_v_i;
 
8258
        if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_null_mask;
 
8259
        __pyx_t_9 = (*__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_null_mask.buf, __pyx_t_13, __pyx_bstride_0_null_mask));
 
8260
        if (__pyx_t_9) {
 
8261
 
 
8262
          /* "pandas/lib/src/tseries.pyx":891
 
8263
 *             while i < length:
 
8264
 *                 if null_mask[i]:
 
8265
 *                     i += 1             # <<<<<<<<<<<<<<
 
8266
 *                     continue
 
8267
 * 
 
8268
 */
 
8269
          __pyx_v_i += 1;
 
8270
 
 
8271
          /* "pandas/lib/src/tseries.pyx":892
 
8272
 *                 if null_mask[i]:
 
8273
 *                     i += 1
 
8274
 *                     continue             # <<<<<<<<<<<<<<
 
8275
 * 
 
8276
 *                 idx = index[i]
 
8277
 */
 
8278
          goto __pyx_L17_continue;
 
8279
          goto __pyx_L19;
 
8280
        }
 
8281
        __pyx_L19:;
 
8282
 
 
8283
        /* "pandas/lib/src/tseries.pyx":894
 
8284
 *                     continue
 
8285
 * 
 
8286
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
8287
 *                 key = mapped_index[i]
 
8288
 *                 if key == curKey:
 
8289
 */
 
8290
        __pyx_t_14 = __pyx_v_i;
 
8291
        if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_index;
 
8292
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_14, __pyx_bstride_0_index);
 
8293
        __Pyx_INCREF((PyObject*)__pyx_1);
 
8294
        __Pyx_DECREF(__pyx_v_idx);
 
8295
        __pyx_v_idx = __pyx_1;
 
8296
        __pyx_1 = 0;
 
8297
 
 
8298
        /* "pandas/lib/src/tseries.pyx":895
 
8299
 * 
 
8300
 *                 idx = index[i]
 
8301
 *                 key = mapped_index[i]             # <<<<<<<<<<<<<<
 
8302
 *                 if key == curKey:
 
8303
 *                     members.append(idx)
 
8304
 */
 
8305
        __pyx_t_15 = __pyx_v_i;
 
8306
        if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_mapped_index;
 
8307
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_15, __pyx_bstride_0_mapped_index);
 
8308
        __Pyx_INCREF((PyObject*)__pyx_1);
 
8309
        __Pyx_DECREF(__pyx_v_key);
 
8310
        __pyx_v_key = __pyx_1;
 
8311
        __pyx_1 = 0;
 
8312
 
 
8313
        /* "pandas/lib/src/tseries.pyx":896
 
8314
 *                 idx = index[i]
 
8315
 *                 key = mapped_index[i]
 
8316
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
8317
 *                     members.append(idx)
 
8318
 *                     i += 1
 
8319
 */
 
8320
        __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8321
        __Pyx_GOTREF(__pyx_t_3);
 
8322
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8323
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
8324
        if (__pyx_t_2) {
 
8325
 
 
8326
          /* "pandas/lib/src/tseries.pyx":897
 
8327
 *                 key = mapped_index[i]
 
8328
 *                 if key == curKey:
 
8329
 *                     members.append(idx)             # <<<<<<<<<<<<<<
 
8330
 *                     i += 1
 
8331
 *                 else:
 
8332
 */
 
8333
          __pyx_t_16 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8334
 
 
8335
          /* "pandas/lib/src/tseries.pyx":898
 
8336
 *                 if key == curKey:
 
8337
 *                     members.append(idx)
 
8338
 *                     i += 1             # <<<<<<<<<<<<<<
 
8339
 *                 else:
 
8340
 *                     break
 
8341
 */
 
8342
          __pyx_v_i += 1;
 
8343
          goto __pyx_L20;
 
8344
        }
 
8345
        /*else*/ {
 
8346
 
 
8347
          /* "pandas/lib/src/tseries.pyx":900
 
8348
 *                     i += 1
 
8349
 *                 else:
 
8350
 *                     break             # <<<<<<<<<<<<<<
 
8351
 * 
 
8352
 *     return groups
 
8353
 */
 
8354
          goto __pyx_L18_break;
 
8355
        }
 
8356
        __pyx_L20:;
 
8357
        __pyx_L17_continue:;
 
8358
      }
 
8359
      __pyx_L18_break:;
 
8360
    }
 
8361
    __pyx_L10:;
 
8362
  }
 
8363
 
 
8364
  /* "pandas/lib/src/tseries.pyx":902
 
8365
 *                     break
 
8366
 * 
 
8367
 *     return groups             # <<<<<<<<<<<<<<
 
8368
 * 
 
8369
 * @cython.boundscheck(False)
 
8370
 */
 
8371
  __Pyx_XDECREF(__pyx_r);
 
8372
  __Pyx_INCREF(((PyObject *)__pyx_v_groups));
 
8373
  __pyx_r = ((PyObject *)__pyx_v_groups);
 
8374
  goto __pyx_L0;
 
8375
 
 
8376
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
8377
  goto __pyx_L0;
 
8378
  __pyx_L1_error:;
 
8379
  __Pyx_XDECREF(__pyx_1);
 
8380
  __Pyx_XDECREF(__pyx_t_1);
 
8381
  __Pyx_XDECREF(__pyx_t_3);
 
8382
  __Pyx_XDECREF(__pyx_t_5);
 
8383
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
8384
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
8385
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
8386
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_null_mask);
 
8387
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
 
8388
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
8389
  __Pyx_AddTraceback("tseries.groupby_withnull");
 
8390
  __pyx_r = NULL;
 
8391
  goto __pyx_L2;
 
8392
  __pyx_L0:;
 
8393
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
8394
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_null_mask);
 
8395
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
 
8396
  __pyx_L2:;
 
8397
  __Pyx_DECREF(__pyx_v_groups);
 
8398
  __Pyx_DECREF(__pyx_v_idx);
 
8399
  __Pyx_DECREF(__pyx_v_curKey);
 
8400
  __Pyx_DECREF(__pyx_v_key);
 
8401
  __Pyx_DECREF(__pyx_v_members);
 
8402
  __Pyx_XDECREF((PyObject *)__pyx_v_mapped_index);
 
8403
  __Pyx_XDECREF((PyObject *)__pyx_v_null_mask);
 
8404
  __Pyx_DECREF(__pyx_v_bool_mask);
 
8405
  __Pyx_DECREF(__pyx_v_null_values);
 
8406
  __Pyx_XGIVEREF(__pyx_r);
 
8407
  __Pyx_FinishRefcountContext();
 
8408
  return __pyx_r;
 
8409
}
 
8410
 
 
8411
/* "pandas/lib/src/tseries.pyx":905
 
8412
 * 
 
8413
 * @cython.boundscheck(False)
 
8414
 * def groupby(ndarray[object, ndim = 1] index, object keyfunc):             # <<<<<<<<<<<<<<
 
8415
 *     cdef dict groups
 
8416
 *     cdef int length = index.shape[0]
 
8417
 */
 
8418
 
 
8419
static PyObject *__pyx_pf_7tseries_groupby(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
8420
static PyObject *__pyx_pf_7tseries_groupby(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
8421
  PyArrayObject *__pyx_v_index = 0;
 
8422
  PyObject *__pyx_v_keyfunc = 0;
 
8423
  PyObject *__pyx_v_groups;
 
8424
  int __pyx_v_length;
 
8425
  PyObject *__pyx_v_idx;
 
8426
  PyObject *__pyx_v_curKey;
 
8427
  PyObject *__pyx_v_key;
 
8428
  PyObject *__pyx_v_members;
 
8429
  int __pyx_v_i;
 
8430
  Py_buffer __pyx_bstruct_index;
 
8431
  Py_ssize_t __pyx_bstride_0_index = 0;
 
8432
  Py_ssize_t __pyx_bshape_0_index = 0;
 
8433
  PyObject *__pyx_r = NULL;
 
8434
  PyObject *__pyx_1 = 0;
 
8435
  PyObject *__pyx_t_1 = NULL;
 
8436
  int __pyx_t_2;
 
8437
  PyObject *__pyx_t_3 = NULL;
 
8438
  int __pyx_t_4;
 
8439
  int __pyx_t_5;
 
8440
  int __pyx_t_6;
 
8441
  PyObject *__pyx_t_7;
 
8442
  int __pyx_t_8;
 
8443
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_keyfunc,0};
 
8444
  __Pyx_SetupRefcountContext("groupby");
 
8445
  __pyx_self = __pyx_self;
 
8446
  if (unlikely(__pyx_kwds)) {
 
8447
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
8448
    PyObject* values[2] = {0,0};
 
8449
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
8450
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
8451
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
8452
      case  0: break;
 
8453
      default: goto __pyx_L5_argtuple_error;
 
8454
    }
 
8455
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
8456
      case  0:
 
8457
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
8458
      if (likely(values[0])) kw_args--;
 
8459
      else goto __pyx_L5_argtuple_error;
 
8460
      case  1:
 
8461
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_keyfunc);
 
8462
      if (likely(values[1])) kw_args--;
 
8463
      else {
 
8464
        __Pyx_RaiseArgtupleInvalid("groupby", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
8465
      }
 
8466
    }
 
8467
    if (unlikely(kw_args > 0)) {
 
8468
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "groupby") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
8469
    }
 
8470
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
8471
    __pyx_v_keyfunc = values[1];
 
8472
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
 
8473
    goto __pyx_L5_argtuple_error;
 
8474
  } else {
 
8475
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
8476
    __pyx_v_keyfunc = PyTuple_GET_ITEM(__pyx_args, 1);
 
8477
  }
 
8478
  goto __pyx_L4_argument_unpacking_done;
 
8479
  __pyx_L5_argtuple_error:;
 
8480
  __Pyx_RaiseArgtupleInvalid("groupby", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
8481
  __pyx_L3_error:;
 
8482
  __Pyx_AddTraceback("tseries.groupby");
 
8483
  return NULL;
 
8484
  __pyx_L4_argument_unpacking_done:;
 
8485
  __pyx_v_groups = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
8486
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
8487
  __pyx_v_curKey = Py_None; __Pyx_INCREF(Py_None);
 
8488
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
 
8489
  __pyx_v_members = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
8490
  __pyx_bstruct_index.buf = NULL;
 
8491
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8492
  {
 
8493
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
8494
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8495
  }
 
8496
  __pyx_bstride_0_index = __pyx_bstruct_index.strides[0];
 
8497
  __pyx_bshape_0_index = __pyx_bstruct_index.shape[0];
 
8498
 
 
8499
  /* "pandas/lib/src/tseries.pyx":907
 
8500
 * def groupby(ndarray[object, ndim = 1] index, object keyfunc):
 
8501
 *     cdef dict groups
 
8502
 *     cdef int length = index.shape[0]             # <<<<<<<<<<<<<<
 
8503
 *     cdef object idx
 
8504
 *     cdef object curKey, key
 
8505
 */
 
8506
  __pyx_v_length = (__pyx_v_index->dimensions[0]);
 
8507
 
 
8508
  /* "pandas/lib/src/tseries.pyx":912
 
8509
 *     cdef list members
 
8510
 * 
 
8511
 *     groups = PyDict_New()             # <<<<<<<<<<<<<<
 
8512
 * 
 
8513
 *     if length != index.shape[0]:
 
8514
 */
 
8515
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8516
  __Pyx_GOTREF(__pyx_t_1);
 
8517
  if (!(likely(PyDict_CheckExact(__pyx_t_1)) || (__pyx_t_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected dict, got %s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8518
  __Pyx_DECREF(((PyObject *)__pyx_v_groups));
 
8519
  __pyx_v_groups = ((PyObject *)__pyx_t_1);
 
8520
  __pyx_t_1 = 0;
 
8521
 
 
8522
  /* "pandas/lib/src/tseries.pyx":914
 
8523
 *     groups = PyDict_New()
 
8524
 * 
 
8525
 *     if length != index.shape[0]:             # <<<<<<<<<<<<<<
 
8526
 *         raise Exception('Dates and values were not the same length!')
 
8527
 * 
 
8528
 */
 
8529
  __pyx_t_2 = (__pyx_v_length != (__pyx_v_index->dimensions[0]));
 
8530
  if (__pyx_t_2) {
 
8531
 
 
8532
    /* "pandas/lib/src/tseries.pyx":915
 
8533
 * 
 
8534
 *     if length != index.shape[0]:
 
8535
 *         raise Exception('Dates and values were not the same length!')             # <<<<<<<<<<<<<<
 
8536
 * 
 
8537
 *     cdef int i = 0
 
8538
 */
 
8539
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8540
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
8541
    __Pyx_INCREF(__pyx_kp_52);
 
8542
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_52);
 
8543
    __Pyx_GIVEREF(__pyx_kp_52);
 
8544
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8545
    __Pyx_GOTREF(__pyx_t_3);
 
8546
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
8547
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
8548
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
8549
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8550
    goto __pyx_L6;
 
8551
  }
 
8552
  __pyx_L6:;
 
8553
 
 
8554
  /* "pandas/lib/src/tseries.pyx":917
 
8555
 *         raise Exception('Dates and values were not the same length!')
 
8556
 * 
 
8557
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 
8558
 *     idx = index[i]
 
8559
 *     key = keyfunc(idx)
 
8560
 */
 
8561
  __pyx_v_i = 0;
 
8562
 
 
8563
  /* "pandas/lib/src/tseries.pyx":918
 
8564
 * 
 
8565
 *     cdef int i = 0
 
8566
 *     idx = index[i]             # <<<<<<<<<<<<<<
 
8567
 *     key = keyfunc(idx)
 
8568
 * 
 
8569
 */
 
8570
  __pyx_t_4 = __pyx_v_i;
 
8571
  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_index;
 
8572
  __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_4, __pyx_bstride_0_index);
 
8573
  __Pyx_INCREF((PyObject*)__pyx_1);
 
8574
  __Pyx_DECREF(__pyx_v_idx);
 
8575
  __pyx_v_idx = __pyx_1;
 
8576
  __pyx_1 = 0;
 
8577
 
 
8578
  /* "pandas/lib/src/tseries.pyx":919
 
8579
 *     cdef int i = 0
 
8580
 *     idx = index[i]
 
8581
 *     key = keyfunc(idx)             # <<<<<<<<<<<<<<
 
8582
 * 
 
8583
 *     # Algorithm notes
 
8584
 */
 
8585
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8586
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
8587
  __Pyx_INCREF(__pyx_v_idx);
 
8588
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_idx);
 
8589
  __Pyx_GIVEREF(__pyx_v_idx);
 
8590
  __pyx_t_1 = PyObject_Call(__pyx_v_keyfunc, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8591
  __Pyx_GOTREF(__pyx_t_1);
 
8592
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
8593
  __Pyx_DECREF(__pyx_v_key);
 
8594
  __pyx_v_key = __pyx_t_1;
 
8595
  __pyx_t_1 = 0;
 
8596
 
 
8597
  /* "pandas/lib/src/tseries.pyx":924
 
8598
 *     #   - Tries to reduce the number of calls to PyDict_GetItem, 'lazily' evaluates
 
8599
 * 
 
8600
 *     while i < length:             # <<<<<<<<<<<<<<
 
8601
 *         if not PyDict_Contains(groups, key):
 
8602
 *             members = [idx]
 
8603
 */
 
8604
  while (1) {
 
8605
    __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
8606
    if (!__pyx_t_2) break;
 
8607
 
 
8608
    /* "pandas/lib/src/tseries.pyx":925
 
8609
 * 
 
8610
 *     while i < length:
 
8611
 *         if not PyDict_Contains(groups, key):             # <<<<<<<<<<<<<<
 
8612
 *             members = [idx]
 
8613
 *             PyDict_SetItem(groups, key, members)
 
8614
 */
 
8615
    __pyx_t_2 = (!PyDict_Contains(((PyObject *)__pyx_v_groups), __pyx_v_key));
 
8616
    if (__pyx_t_2) {
 
8617
 
 
8618
      /* "pandas/lib/src/tseries.pyx":926
 
8619
 *     while i < length:
 
8620
 *         if not PyDict_Contains(groups, key):
 
8621
 *             members = [idx]             # <<<<<<<<<<<<<<
 
8622
 *             PyDict_SetItem(groups, key, members)
 
8623
 *             i += 1
 
8624
 */
 
8625
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8626
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
8627
      __Pyx_INCREF(__pyx_v_idx);
 
8628
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_idx);
 
8629
      __Pyx_GIVEREF(__pyx_v_idx);
 
8630
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
8631
      __pyx_v_members = __pyx_t_1;
 
8632
      __pyx_t_1 = 0;
 
8633
 
 
8634
      /* "pandas/lib/src/tseries.pyx":927
 
8635
 *         if not PyDict_Contains(groups, key):
 
8636
 *             members = [idx]
 
8637
 *             PyDict_SetItem(groups, key, members)             # <<<<<<<<<<<<<<
 
8638
 *             i += 1
 
8639
 *             curKey = key
 
8640
 */
 
8641
      PyDict_SetItem(((PyObject *)__pyx_v_groups), __pyx_v_key, ((PyObject *)__pyx_v_members));
 
8642
 
 
8643
      /* "pandas/lib/src/tseries.pyx":928
 
8644
 *             members = [idx]
 
8645
 *             PyDict_SetItem(groups, key, members)
 
8646
 *             i += 1             # <<<<<<<<<<<<<<
 
8647
 *             curKey = key
 
8648
 *             while i < length:
 
8649
 */
 
8650
      __pyx_v_i += 1;
 
8651
 
 
8652
      /* "pandas/lib/src/tseries.pyx":929
 
8653
 *             PyDict_SetItem(groups, key, members)
 
8654
 *             i += 1
 
8655
 *             curKey = key             # <<<<<<<<<<<<<<
 
8656
 *             while i < length:
 
8657
 *                 idx = index[i]
 
8658
 */
 
8659
      __Pyx_INCREF(__pyx_v_key);
 
8660
      __Pyx_DECREF(__pyx_v_curKey);
 
8661
      __pyx_v_curKey = __pyx_v_key;
 
8662
 
 
8663
      /* "pandas/lib/src/tseries.pyx":930
 
8664
 *             i += 1
 
8665
 *             curKey = key
 
8666
 *             while i < length:             # <<<<<<<<<<<<<<
 
8667
 *                 idx = index[i]
 
8668
 *                 key = trycall(keyfunc, idx)
 
8669
 */
 
8670
      while (1) {
 
8671
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
8672
        if (!__pyx_t_2) break;
 
8673
 
 
8674
        /* "pandas/lib/src/tseries.pyx":931
 
8675
 *             curKey = key
 
8676
 *             while i < length:
 
8677
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
8678
 *                 key = trycall(keyfunc, idx)
 
8679
 *                 if key == curKey:
 
8680
 */
 
8681
        __pyx_t_5 = __pyx_v_i;
 
8682
        if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_index;
 
8683
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_5, __pyx_bstride_0_index);
 
8684
        __Pyx_INCREF((PyObject*)__pyx_1);
 
8685
        __Pyx_DECREF(__pyx_v_idx);
 
8686
        __pyx_v_idx = __pyx_1;
 
8687
        __pyx_1 = 0;
 
8688
 
 
8689
        /* "pandas/lib/src/tseries.pyx":932
 
8690
 *             while i < length:
 
8691
 *                 idx = index[i]
 
8692
 *                 key = trycall(keyfunc, idx)             # <<<<<<<<<<<<<<
 
8693
 *                 if key == curKey:
 
8694
 *                     members.append(idx)
 
8695
 */
 
8696
        __pyx_t_1 = __pyx_f_7tseries_trycall(__pyx_v_keyfunc, __pyx_v_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8697
        __Pyx_GOTREF(__pyx_t_1);
 
8698
        __Pyx_DECREF(__pyx_v_key);
 
8699
        __pyx_v_key = __pyx_t_1;
 
8700
        __pyx_t_1 = 0;
 
8701
 
 
8702
        /* "pandas/lib/src/tseries.pyx":933
 
8703
 *                 idx = index[i]
 
8704
 *                 key = trycall(keyfunc, idx)
 
8705
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
8706
 *                     members.append(idx)
 
8707
 *                     i += 1
 
8708
 */
 
8709
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8710
        __Pyx_GOTREF(__pyx_t_1);
 
8711
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8712
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
8713
        if (__pyx_t_2) {
 
8714
 
 
8715
          /* "pandas/lib/src/tseries.pyx":934
 
8716
 *                 key = trycall(keyfunc, idx)
 
8717
 *                 if key == curKey:
 
8718
 *                     members.append(idx)             # <<<<<<<<<<<<<<
 
8719
 *                     i += 1
 
8720
 *                 else:
 
8721
 */
 
8722
          __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8723
 
 
8724
          /* "pandas/lib/src/tseries.pyx":935
 
8725
 *                 if key == curKey:
 
8726
 *                     members.append(idx)
 
8727
 *                     i += 1             # <<<<<<<<<<<<<<
 
8728
 *                 else:
 
8729
 *                     break
 
8730
 */
 
8731
          __pyx_v_i += 1;
 
8732
          goto __pyx_L12;
 
8733
        }
 
8734
        /*else*/ {
 
8735
 
 
8736
          /* "pandas/lib/src/tseries.pyx":937
 
8737
 *                     i += 1
 
8738
 *                 else:
 
8739
 *                     break             # <<<<<<<<<<<<<<
 
8740
 *         else:
 
8741
 *             members = <list> PyDict_GetItem(groups, key)
 
8742
 */
 
8743
          goto __pyx_L11_break;
 
8744
        }
 
8745
        __pyx_L12:;
 
8746
      }
 
8747
      __pyx_L11_break:;
 
8748
      goto __pyx_L9;
 
8749
    }
 
8750
    /*else*/ {
 
8751
 
 
8752
      /* "pandas/lib/src/tseries.pyx":939
 
8753
 *                     break
 
8754
 *         else:
 
8755
 *             members = <list> PyDict_GetItem(groups, key)             # <<<<<<<<<<<<<<
 
8756
 *             members.append(idx)
 
8757
 *             i += 1
 
8758
 */
 
8759
      __pyx_t_7 = PyDict_GetItem(((PyObject *)__pyx_v_groups), __pyx_v_key);
 
8760
      __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_7)));
 
8761
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
8762
      __pyx_v_members = ((PyObject *)__pyx_t_7);
 
8763
 
 
8764
      /* "pandas/lib/src/tseries.pyx":940
 
8765
 *         else:
 
8766
 *             members = <list> PyDict_GetItem(groups, key)
 
8767
 *             members.append(idx)             # <<<<<<<<<<<<<<
 
8768
 *             i += 1
 
8769
 *             curKey = key
 
8770
 */
 
8771
      __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8772
 
 
8773
      /* "pandas/lib/src/tseries.pyx":941
 
8774
 *             members = <list> PyDict_GetItem(groups, key)
 
8775
 *             members.append(idx)
 
8776
 *             i += 1             # <<<<<<<<<<<<<<
 
8777
 *             curKey = key
 
8778
 *             while i < length:
 
8779
 */
 
8780
      __pyx_v_i += 1;
 
8781
 
 
8782
      /* "pandas/lib/src/tseries.pyx":942
 
8783
 *             members.append(idx)
 
8784
 *             i += 1
 
8785
 *             curKey = key             # <<<<<<<<<<<<<<
 
8786
 *             while i < length:
 
8787
 *                 idx = index[i]
 
8788
 */
 
8789
      __Pyx_INCREF(__pyx_v_key);
 
8790
      __Pyx_DECREF(__pyx_v_curKey);
 
8791
      __pyx_v_curKey = __pyx_v_key;
 
8792
 
 
8793
      /* "pandas/lib/src/tseries.pyx":943
 
8794
 *             i += 1
 
8795
 *             curKey = key
 
8796
 *             while i < length:             # <<<<<<<<<<<<<<
 
8797
 *                 idx = index[i]
 
8798
 *                 key = trycall(keyfunc, idx)
 
8799
 */
 
8800
      while (1) {
 
8801
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
8802
        if (!__pyx_t_2) break;
 
8803
 
 
8804
        /* "pandas/lib/src/tseries.pyx":944
 
8805
 *             curKey = key
 
8806
 *             while i < length:
 
8807
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
8808
 *                 key = trycall(keyfunc, idx)
 
8809
 *                 if key == curKey:
 
8810
 */
 
8811
        __pyx_t_6 = __pyx_v_i;
 
8812
        if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_index;
 
8813
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_6, __pyx_bstride_0_index);
 
8814
        __Pyx_INCREF((PyObject*)__pyx_1);
 
8815
        __Pyx_DECREF(__pyx_v_idx);
 
8816
        __pyx_v_idx = __pyx_1;
 
8817
        __pyx_1 = 0;
 
8818
 
 
8819
        /* "pandas/lib/src/tseries.pyx":945
 
8820
 *             while i < length:
 
8821
 *                 idx = index[i]
 
8822
 *                 key = trycall(keyfunc, idx)             # <<<<<<<<<<<<<<
 
8823
 *                 if key == curKey:
 
8824
 *                     members.append(idx)
 
8825
 */
 
8826
        __pyx_t_1 = __pyx_f_7tseries_trycall(__pyx_v_keyfunc, __pyx_v_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8827
        __Pyx_GOTREF(__pyx_t_1);
 
8828
        __Pyx_DECREF(__pyx_v_key);
 
8829
        __pyx_v_key = __pyx_t_1;
 
8830
        __pyx_t_1 = 0;
 
8831
 
 
8832
        /* "pandas/lib/src/tseries.pyx":946
 
8833
 *                 idx = index[i]
 
8834
 *                 key = trycall(keyfunc, idx)
 
8835
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
8836
 *                     members.append(idx)
 
8837
 *                     i += 1
 
8838
 */
 
8839
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8840
        __Pyx_GOTREF(__pyx_t_1);
 
8841
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8842
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
8843
        if (__pyx_t_2) {
 
8844
 
 
8845
          /* "pandas/lib/src/tseries.pyx":947
 
8846
 *                 key = trycall(keyfunc, idx)
 
8847
 *                 if key == curKey:
 
8848
 *                     members.append(idx)             # <<<<<<<<<<<<<<
 
8849
 *                     i += 1
 
8850
 *                 else:
 
8851
 */
 
8852
          __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
8853
 
 
8854
          /* "pandas/lib/src/tseries.pyx":948
 
8855
 *                 if key == curKey:
 
8856
 *                     members.append(idx)
 
8857
 *                     i += 1             # <<<<<<<<<<<<<<
 
8858
 *                 else:
 
8859
 *                     break
 
8860
 */
 
8861
          __pyx_v_i += 1;
 
8862
          goto __pyx_L15;
 
8863
        }
 
8864
        /*else*/ {
 
8865
 
 
8866
          /* "pandas/lib/src/tseries.pyx":950
 
8867
 *                     i += 1
 
8868
 *                 else:
 
8869
 *                     break             # <<<<<<<<<<<<<<
 
8870
 * 
 
8871
 *     return groups
 
8872
 */
 
8873
          goto __pyx_L14_break;
 
8874
        }
 
8875
        __pyx_L15:;
 
8876
      }
 
8877
      __pyx_L14_break:;
 
8878
    }
 
8879
    __pyx_L9:;
 
8880
  }
 
8881
 
 
8882
  /* "pandas/lib/src/tseries.pyx":952
 
8883
 *                     break
 
8884
 * 
 
8885
 *     return groups             # <<<<<<<<<<<<<<
 
8886
 * 
 
8887
 * @cython.boundscheck(False)
 
8888
 */
 
8889
  __Pyx_XDECREF(__pyx_r);
 
8890
  __Pyx_INCREF(((PyObject *)__pyx_v_groups));
 
8891
  __pyx_r = ((PyObject *)__pyx_v_groups);
 
8892
  goto __pyx_L0;
 
8893
 
 
8894
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
8895
  goto __pyx_L0;
 
8896
  __pyx_L1_error:;
 
8897
  __Pyx_XDECREF(__pyx_1);
 
8898
  __Pyx_XDECREF(__pyx_t_1);
 
8899
  __Pyx_XDECREF(__pyx_t_3);
 
8900
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
8901
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
8902
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
8903
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
8904
  __Pyx_AddTraceback("tseries.groupby");
 
8905
  __pyx_r = NULL;
 
8906
  goto __pyx_L2;
 
8907
  __pyx_L0:;
 
8908
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
8909
  __pyx_L2:;
 
8910
  __Pyx_DECREF(__pyx_v_groups);
 
8911
  __Pyx_DECREF(__pyx_v_idx);
 
8912
  __Pyx_DECREF(__pyx_v_curKey);
 
8913
  __Pyx_DECREF(__pyx_v_key);
 
8914
  __Pyx_DECREF(__pyx_v_members);
 
8915
  __Pyx_XGIVEREF(__pyx_r);
 
8916
  __Pyx_FinishRefcountContext();
 
8917
  return __pyx_r;
 
8918
}
 
8919
 
 
8920
/* "pandas/lib/src/tseries.pyx":955
 
8921
 * 
 
8922
 * @cython.boundscheck(False)
 
8923
 * def groupbyfunc(ndarray[object, ndim = 1] index,             # <<<<<<<<<<<<<<
 
8924
 *                 ndarray[npy_float64, ndim = 1] values,
 
8925
 *                 object keyfunc, object applyfunc):
 
8926
 */
 
8927
 
 
8928
static PyObject *__pyx_pf_7tseries_groupbyfunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
8929
static char __pyx_doc_7tseries_groupbyfunc[] = "\n    Doing this proper in Cython\n    Not sure how much it will really speed things up\n    ";
 
8930
static PyObject *__pyx_pf_7tseries_groupbyfunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
8931
  PyArrayObject *__pyx_v_index = 0;
 
8932
  PyArrayObject *__pyx_v_values = 0;
 
8933
  PyObject *__pyx_v_keyfunc = 0;
 
8934
  PyObject *__pyx_v_applyfunc = 0;
 
8935
  PyObject *__pyx_v_groups;
 
8936
  int __pyx_v_length;
 
8937
  PyObject *__pyx_v_idx;
 
8938
  PyObject *__pyx_v_curKey;
 
8939
  PyObject *__pyx_v_key;
 
8940
  PyObject *__pyx_v_members;
 
8941
  PyObject *__pyx_v_grouplist;
 
8942
  int __pyx_v_i;
 
8943
  Py_buffer __pyx_bstruct_index;
 
8944
  Py_ssize_t __pyx_bstride_0_index = 0;
 
8945
  Py_ssize_t __pyx_bshape_0_index = 0;
 
8946
  Py_buffer __pyx_bstruct_values;
 
8947
  Py_ssize_t __pyx_bstride_0_values = 0;
 
8948
  Py_ssize_t __pyx_bshape_0_values = 0;
 
8949
  PyObject *__pyx_r = NULL;
 
8950
  PyObject *__pyx_1 = 0;
 
8951
  PyObject *__pyx_t_1 = NULL;
 
8952
  int __pyx_t_2;
 
8953
  PyObject *__pyx_t_3 = NULL;
 
8954
  int __pyx_t_4;
 
8955
  int __pyx_t_5;
 
8956
  int __pyx_t_6;
 
8957
  int __pyx_t_7;
 
8958
  int __pyx_t_8;
 
8959
  PyObject *__pyx_t_9;
 
8960
  int __pyx_t_10;
 
8961
  int __pyx_t_11;
 
8962
  int __pyx_t_12;
 
8963
  Py_ssize_t __pyx_t_13;
 
8964
  PyObject *__pyx_t_14 = NULL;
 
8965
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_values,&__pyx_kp_keyfunc,&__pyx_kp_applyfunc,0};
 
8966
  __Pyx_SetupRefcountContext("groupbyfunc");
 
8967
  __pyx_self = __pyx_self;
 
8968
  if (unlikely(__pyx_kwds)) {
 
8969
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
8970
    PyObject* values[4] = {0,0,0,0};
 
8971
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
8972
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
 
8973
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
 
8974
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
8975
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
8976
      case  0: break;
 
8977
      default: goto __pyx_L5_argtuple_error;
 
8978
    }
 
8979
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
8980
      case  0:
 
8981
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_index);
 
8982
      if (likely(values[0])) kw_args--;
 
8983
      else goto __pyx_L5_argtuple_error;
 
8984
      case  1:
 
8985
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_values);
 
8986
      if (likely(values[1])) kw_args--;
 
8987
      else {
 
8988
        __Pyx_RaiseArgtupleInvalid("groupbyfunc", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
8989
      }
 
8990
      case  2:
 
8991
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_keyfunc);
 
8992
      if (likely(values[2])) kw_args--;
 
8993
      else {
 
8994
        __Pyx_RaiseArgtupleInvalid("groupbyfunc", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
8995
      }
 
8996
      case  3:
 
8997
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_applyfunc);
 
8998
      if (likely(values[3])) kw_args--;
 
8999
      else {
 
9000
        __Pyx_RaiseArgtupleInvalid("groupbyfunc", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
9001
      }
 
9002
    }
 
9003
    if (unlikely(kw_args > 0)) {
 
9004
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "groupbyfunc") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
9005
    }
 
9006
    __pyx_v_index = ((PyArrayObject *)values[0]);
 
9007
    __pyx_v_values = ((PyArrayObject *)values[1]);
 
9008
    __pyx_v_keyfunc = values[2];
 
9009
    __pyx_v_applyfunc = values[3];
 
9010
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
 
9011
    goto __pyx_L5_argtuple_error;
 
9012
  } else {
 
9013
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
 
9014
    __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
 
9015
    __pyx_v_keyfunc = PyTuple_GET_ITEM(__pyx_args, 2);
 
9016
    __pyx_v_applyfunc = PyTuple_GET_ITEM(__pyx_args, 3);
 
9017
  }
 
9018
  goto __pyx_L4_argument_unpacking_done;
 
9019
  __pyx_L5_argtuple_error:;
 
9020
  __Pyx_RaiseArgtupleInvalid("groupbyfunc", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
9021
  __pyx_L3_error:;
 
9022
  __Pyx_AddTraceback("tseries.groupbyfunc");
 
9023
  return NULL;
 
9024
  __pyx_L4_argument_unpacking_done:;
 
9025
  __pyx_v_groups = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
9026
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
 
9027
  __pyx_v_curKey = Py_None; __Pyx_INCREF(Py_None);
 
9028
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
 
9029
  __pyx_v_members = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
9030
  __pyx_v_grouplist = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
9031
  __pyx_bstruct_index.buf = NULL;
 
9032
  __pyx_bstruct_values.buf = NULL;
 
9033
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9034
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9035
  {
 
9036
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
9037
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9038
  }
 
9039
  __pyx_bstride_0_index = __pyx_bstruct_index.strides[0];
 
9040
  __pyx_bshape_0_index = __pyx_bstruct_index.shape[0];
 
9041
  {
 
9042
    __Pyx_BufFmt_StackElem __pyx_stack[1];
 
9043
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn_npy_float64, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9044
  }
 
9045
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
 
9046
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
 
9047
 
 
9048
  /* "pandas/lib/src/tseries.pyx":963
 
9049
 *     '''
 
9050
 *     cdef dict groups
 
9051
 *     cdef int length = values.shape[0]             # <<<<<<<<<<<<<<
 
9052
 *     cdef object idx
 
9053
 *     cdef object curKey, key
 
9054
 */
 
9055
  __pyx_v_length = (__pyx_v_values->dimensions[0]);
 
9056
 
 
9057
  /* "pandas/lib/src/tseries.pyx":968
 
9058
 *     cdef list members, grouplist
 
9059
 * 
 
9060
 *     groups = PyDict_New()             # <<<<<<<<<<<<<<
 
9061
 * 
 
9062
 *     if length != index.shape[0]:
 
9063
 */
 
9064
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9065
  __Pyx_GOTREF(__pyx_t_1);
 
9066
  if (!(likely(PyDict_CheckExact(__pyx_t_1)) || (__pyx_t_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected dict, got %s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9067
  __Pyx_DECREF(((PyObject *)__pyx_v_groups));
 
9068
  __pyx_v_groups = ((PyObject *)__pyx_t_1);
 
9069
  __pyx_t_1 = 0;
 
9070
 
 
9071
  /* "pandas/lib/src/tseries.pyx":970
 
9072
 *     groups = PyDict_New()
 
9073
 * 
 
9074
 *     if length != index.shape[0]:             # <<<<<<<<<<<<<<
 
9075
 *         raise Exception('Dates and values were not the same length!')
 
9076
 * 
 
9077
 */
 
9078
  __pyx_t_2 = (__pyx_v_length != (__pyx_v_index->dimensions[0]));
 
9079
  if (__pyx_t_2) {
 
9080
 
 
9081
    /* "pandas/lib/src/tseries.pyx":971
 
9082
 * 
 
9083
 *     if length != index.shape[0]:
 
9084
 *         raise Exception('Dates and values were not the same length!')             # <<<<<<<<<<<<<<
 
9085
 * 
 
9086
 *     cdef int i = 0
 
9087
 */
 
9088
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9089
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
9090
    __Pyx_INCREF(__pyx_kp_53);
 
9091
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_53);
 
9092
    __Pyx_GIVEREF(__pyx_kp_53);
 
9093
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9094
    __Pyx_GOTREF(__pyx_t_3);
 
9095
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
9096
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
9097
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
9098
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9099
    goto __pyx_L6;
 
9100
  }
 
9101
  __pyx_L6:;
 
9102
 
 
9103
  /* "pandas/lib/src/tseries.pyx":973
 
9104
 *         raise Exception('Dates and values were not the same length!')
 
9105
 * 
 
9106
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 
9107
 *     idx = index[i]
 
9108
 *     key = trycall(keyfunc, idx)
 
9109
 */
 
9110
  __pyx_v_i = 0;
 
9111
 
 
9112
  /* "pandas/lib/src/tseries.pyx":974
 
9113
 * 
 
9114
 *     cdef int i = 0
 
9115
 *     idx = index[i]             # <<<<<<<<<<<<<<
 
9116
 *     key = trycall(keyfunc, idx)
 
9117
 * 
 
9118
 */
 
9119
  __pyx_t_4 = __pyx_v_i;
 
9120
  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_index;
 
9121
  __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_4, __pyx_bstride_0_index);
 
9122
  __Pyx_INCREF((PyObject*)__pyx_1);
 
9123
  __Pyx_DECREF(__pyx_v_idx);
 
9124
  __pyx_v_idx = __pyx_1;
 
9125
  __pyx_1 = 0;
 
9126
 
 
9127
  /* "pandas/lib/src/tseries.pyx":975
 
9128
 *     cdef int i = 0
 
9129
 *     idx = index[i]
 
9130
 *     key = trycall(keyfunc, idx)             # <<<<<<<<<<<<<<
 
9131
 * 
 
9132
 *     # Algorithm notes
 
9133
 */
 
9134
  __pyx_t_3 = __pyx_f_7tseries_trycall(__pyx_v_keyfunc, __pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9135
  __Pyx_GOTREF(__pyx_t_3);
 
9136
  __Pyx_DECREF(__pyx_v_key);
 
9137
  __pyx_v_key = __pyx_t_3;
 
9138
  __pyx_t_3 = 0;
 
9139
 
 
9140
  /* "pandas/lib/src/tseries.pyx":981
 
9141
 *     #   'lazily' evaluates
 
9142
 * 
 
9143
 *     while i < length:             # <<<<<<<<<<<<<<
 
9144
 *         if not PyDict_Contains(groups, key):
 
9145
 *             members = [values[i]]
 
9146
 */
 
9147
  while (1) {
 
9148
    __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
9149
    if (!__pyx_t_2) break;
 
9150
 
 
9151
    /* "pandas/lib/src/tseries.pyx":982
 
9152
 * 
 
9153
 *     while i < length:
 
9154
 *         if not PyDict_Contains(groups, key):             # <<<<<<<<<<<<<<
 
9155
 *             members = [values[i]]
 
9156
 *             PyDict_SetItem(groups, key, members)
 
9157
 */
 
9158
    __pyx_t_2 = (!PyDict_Contains(((PyObject *)__pyx_v_groups), __pyx_v_key));
 
9159
    if (__pyx_t_2) {
 
9160
 
 
9161
      /* "pandas/lib/src/tseries.pyx":983
 
9162
 *     while i < length:
 
9163
 *         if not PyDict_Contains(groups, key):
 
9164
 *             members = [values[i]]             # <<<<<<<<<<<<<<
 
9165
 *             PyDict_SetItem(groups, key, members)
 
9166
 *             i += 1
 
9167
 */
 
9168
      __pyx_t_5 = __pyx_v_i;
 
9169
      if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_values;
 
9170
      __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(npy_float64 *, __pyx_bstruct_values.buf, __pyx_t_5, __pyx_bstride_0_values))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9171
      __Pyx_GOTREF(__pyx_t_3);
 
9172
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9173
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
9174
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
 
9175
      __Pyx_GIVEREF(__pyx_t_3);
 
9176
      __pyx_t_3 = 0;
 
9177
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
9178
      __pyx_v_members = __pyx_t_1;
 
9179
      __pyx_t_1 = 0;
 
9180
 
 
9181
      /* "pandas/lib/src/tseries.pyx":984
 
9182
 *         if not PyDict_Contains(groups, key):
 
9183
 *             members = [values[i]]
 
9184
 *             PyDict_SetItem(groups, key, members)             # <<<<<<<<<<<<<<
 
9185
 *             i += 1
 
9186
 *             curKey = key
 
9187
 */
 
9188
      PyDict_SetItem(((PyObject *)__pyx_v_groups), __pyx_v_key, ((PyObject *)__pyx_v_members));
 
9189
 
 
9190
      /* "pandas/lib/src/tseries.pyx":985
 
9191
 *             members = [values[i]]
 
9192
 *             PyDict_SetItem(groups, key, members)
 
9193
 *             i += 1             # <<<<<<<<<<<<<<
 
9194
 *             curKey = key
 
9195
 *             while i < length:
 
9196
 */
 
9197
      __pyx_v_i += 1;
 
9198
 
 
9199
      /* "pandas/lib/src/tseries.pyx":986
 
9200
 *             PyDict_SetItem(groups, key, members)
 
9201
 *             i += 1
 
9202
 *             curKey = key             # <<<<<<<<<<<<<<
 
9203
 *             while i < length:
 
9204
 *                 idx = index[i]
 
9205
 */
 
9206
      __Pyx_INCREF(__pyx_v_key);
 
9207
      __Pyx_DECREF(__pyx_v_curKey);
 
9208
      __pyx_v_curKey = __pyx_v_key;
 
9209
 
 
9210
      /* "pandas/lib/src/tseries.pyx":987
 
9211
 *             i += 1
 
9212
 *             curKey = key
 
9213
 *             while i < length:             # <<<<<<<<<<<<<<
 
9214
 *                 idx = index[i]
 
9215
 *                 key = trycall(keyfunc, idx)
 
9216
 */
 
9217
      while (1) {
 
9218
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
9219
        if (!__pyx_t_2) break;
 
9220
 
 
9221
        /* "pandas/lib/src/tseries.pyx":988
 
9222
 *             curKey = key
 
9223
 *             while i < length:
 
9224
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
9225
 *                 key = trycall(keyfunc, idx)
 
9226
 *                 if key == curKey:
 
9227
 */
 
9228
        __pyx_t_6 = __pyx_v_i;
 
9229
        if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_index;
 
9230
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_6, __pyx_bstride_0_index);
 
9231
        __Pyx_INCREF((PyObject*)__pyx_1);
 
9232
        __Pyx_DECREF(__pyx_v_idx);
 
9233
        __pyx_v_idx = __pyx_1;
 
9234
        __pyx_1 = 0;
 
9235
 
 
9236
        /* "pandas/lib/src/tseries.pyx":989
 
9237
 *             while i < length:
 
9238
 *                 idx = index[i]
 
9239
 *                 key = trycall(keyfunc, idx)             # <<<<<<<<<<<<<<
 
9240
 *                 if key == curKey:
 
9241
 *                     members.append(values[i])
 
9242
 */
 
9243
        __pyx_t_1 = __pyx_f_7tseries_trycall(__pyx_v_keyfunc, __pyx_v_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9244
        __Pyx_GOTREF(__pyx_t_1);
 
9245
        __Pyx_DECREF(__pyx_v_key);
 
9246
        __pyx_v_key = __pyx_t_1;
 
9247
        __pyx_t_1 = 0;
 
9248
 
 
9249
        /* "pandas/lib/src/tseries.pyx":990
 
9250
 *                 idx = index[i]
 
9251
 *                 key = trycall(keyfunc, idx)
 
9252
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
9253
 *                     members.append(values[i])
 
9254
 *                     i += 1
 
9255
 */
 
9256
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9257
        __Pyx_GOTREF(__pyx_t_1);
 
9258
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9259
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
9260
        if (__pyx_t_2) {
 
9261
 
 
9262
          /* "pandas/lib/src/tseries.pyx":991
 
9263
 *                 key = trycall(keyfunc, idx)
 
9264
 *                 if key == curKey:
 
9265
 *                     members.append(values[i])             # <<<<<<<<<<<<<<
 
9266
 *                     i += 1
 
9267
 *                 else:
 
9268
 */
 
9269
          __pyx_t_7 = __pyx_v_i;
 
9270
          if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_values;
 
9271
          __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(npy_float64 *, __pyx_bstruct_values.buf, __pyx_t_7, __pyx_bstride_0_values))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9272
          __Pyx_GOTREF(__pyx_t_1);
 
9273
          __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9274
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
9275
 
 
9276
          /* "pandas/lib/src/tseries.pyx":992
 
9277
 *                 if key == curKey:
 
9278
 *                     members.append(values[i])
 
9279
 *                     i += 1             # <<<<<<<<<<<<<<
 
9280
 *                 else:
 
9281
 *                     break
 
9282
 */
 
9283
          __pyx_v_i += 1;
 
9284
          goto __pyx_L12;
 
9285
        }
 
9286
        /*else*/ {
 
9287
 
 
9288
          /* "pandas/lib/src/tseries.pyx":994
 
9289
 *                     i += 1
 
9290
 *                 else:
 
9291
 *                     break             # <<<<<<<<<<<<<<
 
9292
 *         else:
 
9293
 *             members = <list> PyDict_GetItem(groups, key)
 
9294
 */
 
9295
          goto __pyx_L11_break;
 
9296
        }
 
9297
        __pyx_L12:;
 
9298
      }
 
9299
      __pyx_L11_break:;
 
9300
      goto __pyx_L9;
 
9301
    }
 
9302
    /*else*/ {
 
9303
 
 
9304
      /* "pandas/lib/src/tseries.pyx":996
 
9305
 *                     break
 
9306
 *         else:
 
9307
 *             members = <list> PyDict_GetItem(groups, key)             # <<<<<<<<<<<<<<
 
9308
 *             members.append(values[i])
 
9309
 *             i += 1
 
9310
 */
 
9311
      __pyx_t_9 = PyDict_GetItem(((PyObject *)__pyx_v_groups), __pyx_v_key);
 
9312
      __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_9)));
 
9313
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
9314
      __pyx_v_members = ((PyObject *)__pyx_t_9);
 
9315
 
 
9316
      /* "pandas/lib/src/tseries.pyx":997
 
9317
 *         else:
 
9318
 *             members = <list> PyDict_GetItem(groups, key)
 
9319
 *             members.append(values[i])             # <<<<<<<<<<<<<<
 
9320
 *             i += 1
 
9321
 *             curKey = key
 
9322
 */
 
9323
      __pyx_t_8 = __pyx_v_i;
 
9324
      if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_values;
 
9325
      __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(npy_float64 *, __pyx_bstruct_values.buf, __pyx_t_8, __pyx_bstride_0_values))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9326
      __Pyx_GOTREF(__pyx_t_1);
 
9327
      __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9328
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
9329
 
 
9330
      /* "pandas/lib/src/tseries.pyx":998
 
9331
 *             members = <list> PyDict_GetItem(groups, key)
 
9332
 *             members.append(values[i])
 
9333
 *             i += 1             # <<<<<<<<<<<<<<
 
9334
 *             curKey = key
 
9335
 *             while i < length:
 
9336
 */
 
9337
      __pyx_v_i += 1;
 
9338
 
 
9339
      /* "pandas/lib/src/tseries.pyx":999
 
9340
 *             members.append(values[i])
 
9341
 *             i += 1
 
9342
 *             curKey = key             # <<<<<<<<<<<<<<
 
9343
 *             while i < length:
 
9344
 *                 idx = index[i]
 
9345
 */
 
9346
      __Pyx_INCREF(__pyx_v_key);
 
9347
      __Pyx_DECREF(__pyx_v_curKey);
 
9348
      __pyx_v_curKey = __pyx_v_key;
 
9349
 
 
9350
      /* "pandas/lib/src/tseries.pyx":1000
 
9351
 *             i += 1
 
9352
 *             curKey = key
 
9353
 *             while i < length:             # <<<<<<<<<<<<<<
 
9354
 *                 idx = index[i]
 
9355
 *                 key = trycall(keyfunc, idx)
 
9356
 */
 
9357
      while (1) {
 
9358
        __pyx_t_2 = (__pyx_v_i < __pyx_v_length);
 
9359
        if (!__pyx_t_2) break;
 
9360
 
 
9361
        /* "pandas/lib/src/tseries.pyx":1001
 
9362
 *             curKey = key
 
9363
 *             while i < length:
 
9364
 *                 idx = index[i]             # <<<<<<<<<<<<<<
 
9365
 *                 key = trycall(keyfunc, idx)
 
9366
 *                 if key == curKey:
 
9367
 */
 
9368
        __pyx_t_10 = __pyx_v_i;
 
9369
        if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_index;
 
9370
        __pyx_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_10, __pyx_bstride_0_index);
 
9371
        __Pyx_INCREF((PyObject*)__pyx_1);
 
9372
        __Pyx_DECREF(__pyx_v_idx);
 
9373
        __pyx_v_idx = __pyx_1;
 
9374
        __pyx_1 = 0;
 
9375
 
 
9376
        /* "pandas/lib/src/tseries.pyx":1002
 
9377
 *             while i < length:
 
9378
 *                 idx = index[i]
 
9379
 *                 key = trycall(keyfunc, idx)             # <<<<<<<<<<<<<<
 
9380
 *                 if key == curKey:
 
9381
 *                     members.append(values[i])
 
9382
 */
 
9383
        __pyx_t_1 = __pyx_f_7tseries_trycall(__pyx_v_keyfunc, __pyx_v_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9384
        __Pyx_GOTREF(__pyx_t_1);
 
9385
        __Pyx_DECREF(__pyx_v_key);
 
9386
        __pyx_v_key = __pyx_t_1;
 
9387
        __pyx_t_1 = 0;
 
9388
 
 
9389
        /* "pandas/lib/src/tseries.pyx":1003
 
9390
 *                 idx = index[i]
 
9391
 *                 key = trycall(keyfunc, idx)
 
9392
 *                 if key == curKey:             # <<<<<<<<<<<<<<
 
9393
 *                     members.append(values[i])
 
9394
 *                     i += 1
 
9395
 */
 
9396
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, __pyx_v_curKey, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9397
        __Pyx_GOTREF(__pyx_t_1);
 
9398
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9399
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
9400
        if (__pyx_t_2) {
 
9401
 
 
9402
          /* "pandas/lib/src/tseries.pyx":1004
 
9403
 *                 key = trycall(keyfunc, idx)
 
9404
 *                 if key == curKey:
 
9405
 *                     members.append(values[i])             # <<<<<<<<<<<<<<
 
9406
 *                     i += 1
 
9407
 *                 else:
 
9408
 */
 
9409
          __pyx_t_11 = __pyx_v_i;
 
9410
          if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_values;
 
9411
          __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(npy_float64 *, __pyx_bstruct_values.buf, __pyx_t_11, __pyx_bstride_0_values))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9412
          __Pyx_GOTREF(__pyx_t_1);
 
9413
          __pyx_t_12 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_t_1); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9414
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
9415
 
 
9416
          /* "pandas/lib/src/tseries.pyx":1005
 
9417
 *                 if key == curKey:
 
9418
 *                     members.append(values[i])
 
9419
 *                     i += 1             # <<<<<<<<<<<<<<
 
9420
 *                 else:
 
9421
 *                     break
 
9422
 */
 
9423
          __pyx_v_i += 1;
 
9424
          goto __pyx_L15;
 
9425
        }
 
9426
        /*else*/ {
 
9427
 
 
9428
          /* "pandas/lib/src/tseries.pyx":1007
 
9429
 *                     i += 1
 
9430
 *                 else:
 
9431
 *                     break             # <<<<<<<<<<<<<<
 
9432
 * 
 
9433
 *     grouplist = PyDict_Keys(groups)
 
9434
 */
 
9435
          goto __pyx_L14_break;
 
9436
        }
 
9437
        __pyx_L15:;
 
9438
      }
 
9439
      __pyx_L14_break:;
 
9440
    }
 
9441
    __pyx_L9:;
 
9442
  }
 
9443
 
 
9444
  /* "pandas/lib/src/tseries.pyx":1009
 
9445
 *                     break
 
9446
 * 
 
9447
 *     grouplist = PyDict_Keys(groups)             # <<<<<<<<<<<<<<
 
9448
 * 
 
9449
 *     i = 0
 
9450
 */
 
9451
  __pyx_t_1 = PyDict_Keys(((PyObject *)__pyx_v_groups)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9452
  __Pyx_GOTREF(__pyx_t_1);
 
9453
  if (!(likely(PyList_CheckExact(__pyx_t_1)) || (__pyx_t_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected list, got %s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9454
  __Pyx_DECREF(((PyObject *)__pyx_v_grouplist));
 
9455
  __pyx_v_grouplist = ((PyObject *)__pyx_t_1);
 
9456
  __pyx_t_1 = 0;
 
9457
 
 
9458
  /* "pandas/lib/src/tseries.pyx":1011
 
9459
 *     grouplist = PyDict_Keys(groups)
 
9460
 * 
 
9461
 *     i = 0             # <<<<<<<<<<<<<<
 
9462
 *     length = len(grouplist)
 
9463
 *     for i from 0 <= i < length:
 
9464
 */
 
9465
  __pyx_v_i = 0;
 
9466
 
 
9467
  /* "pandas/lib/src/tseries.pyx":1012
 
9468
 * 
 
9469
 *     i = 0
 
9470
 *     length = len(grouplist)             # <<<<<<<<<<<<<<
 
9471
 *     for i from 0 <= i < length:
 
9472
 *         key = grouplist[i]
 
9473
 */
 
9474
  __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_grouplist)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9475
  __pyx_v_length = __pyx_t_13;
 
9476
 
 
9477
  /* "pandas/lib/src/tseries.pyx":1013
 
9478
 *     i = 0
 
9479
 *     length = len(grouplist)
 
9480
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 
9481
 *         key = grouplist[i]
 
9482
 *         members = <list> PyDict_GetItem(groups, key)
 
9483
 */
 
9484
  __pyx_t_12 = __pyx_v_length;
 
9485
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) {
 
9486
 
 
9487
    /* "pandas/lib/src/tseries.pyx":1014
 
9488
 *     length = len(grouplist)
 
9489
 *     for i from 0 <= i < length:
 
9490
 *         key = grouplist[i]             # <<<<<<<<<<<<<<
 
9491
 *         members = <list> PyDict_GetItem(groups, key)
 
9492
 *         PyDict_SetItem(groups, key, applyfunc(np.asarray(members)))
 
9493
 */
 
9494
    __pyx_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_grouplist), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9495
    __Pyx_GOTREF(__pyx_1);
 
9496
    __Pyx_DECREF(__pyx_v_key);
 
9497
    __pyx_v_key = __pyx_1;
 
9498
    __pyx_1 = 0;
 
9499
 
 
9500
    /* "pandas/lib/src/tseries.pyx":1015
 
9501
 *     for i from 0 <= i < length:
 
9502
 *         key = grouplist[i]
 
9503
 *         members = <list> PyDict_GetItem(groups, key)             # <<<<<<<<<<<<<<
 
9504
 *         PyDict_SetItem(groups, key, applyfunc(np.asarray(members)))
 
9505
 * 
 
9506
 */
 
9507
    __pyx_t_9 = PyDict_GetItem(((PyObject *)__pyx_v_groups), __pyx_v_key);
 
9508
    __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_9)));
 
9509
    __Pyx_DECREF(((PyObject *)__pyx_v_members));
 
9510
    __pyx_v_members = ((PyObject *)__pyx_t_9);
 
9511
 
 
9512
    /* "pandas/lib/src/tseries.pyx":1016
 
9513
 *         key = grouplist[i]
 
9514
 *         members = <list> PyDict_GetItem(groups, key)
 
9515
 *         PyDict_SetItem(groups, key, applyfunc(np.asarray(members)))             # <<<<<<<<<<<<<<
 
9516
 * 
 
9517
 *     return groups
 
9518
 */
 
9519
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9520
    __Pyx_GOTREF(__pyx_1);
 
9521
    __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9522
    __Pyx_GOTREF(__pyx_t_1);
 
9523
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
9524
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9525
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
9526
    __Pyx_INCREF(((PyObject *)__pyx_v_members));
 
9527
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_members));
 
9528
    __Pyx_GIVEREF(((PyObject *)__pyx_v_members));
 
9529
    __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9530
    __Pyx_GOTREF(__pyx_t_14);
 
9531
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
9532
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
9533
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9534
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
9535
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_14);
 
9536
    __Pyx_GIVEREF(__pyx_t_14);
 
9537
    __pyx_t_14 = 0;
 
9538
    __pyx_t_14 = PyObject_Call(__pyx_v_applyfunc, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9539
    __Pyx_GOTREF(__pyx_t_14);
 
9540
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
9541
    PyDict_SetItem(((PyObject *)__pyx_v_groups), __pyx_v_key, __pyx_t_14);
 
9542
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
 
9543
  }
 
9544
 
 
9545
  /* "pandas/lib/src/tseries.pyx":1018
 
9546
 *         PyDict_SetItem(groups, key, applyfunc(np.asarray(members)))
 
9547
 * 
 
9548
 *     return groups             # <<<<<<<<<<<<<<
 
9549
 * 
 
9550
 */
 
9551
  __Pyx_XDECREF(__pyx_r);
 
9552
  __Pyx_INCREF(((PyObject *)__pyx_v_groups));
 
9553
  __pyx_r = ((PyObject *)__pyx_v_groups);
 
9554
  goto __pyx_L0;
 
9555
 
 
9556
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
9557
  goto __pyx_L0;
 
9558
  __pyx_L1_error:;
 
9559
  __Pyx_XDECREF(__pyx_1);
 
9560
  __Pyx_XDECREF(__pyx_t_1);
 
9561
  __Pyx_XDECREF(__pyx_t_3);
 
9562
  __Pyx_XDECREF(__pyx_t_14);
 
9563
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
 
9564
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
 
9565
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
9566
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
 
9567
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
 
9568
  __Pyx_AddTraceback("tseries.groupbyfunc");
 
9569
  __pyx_r = NULL;
 
9570
  goto __pyx_L2;
 
9571
  __pyx_L0:;
 
9572
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
 
9573
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
 
9574
  __pyx_L2:;
 
9575
  __Pyx_DECREF(__pyx_v_groups);
 
9576
  __Pyx_DECREF(__pyx_v_idx);
 
9577
  __Pyx_DECREF(__pyx_v_curKey);
 
9578
  __Pyx_DECREF(__pyx_v_key);
 
9579
  __Pyx_DECREF(__pyx_v_members);
 
9580
  __Pyx_DECREF(__pyx_v_grouplist);
 
9581
  __Pyx_XGIVEREF(__pyx_r);
 
9582
  __Pyx_FinishRefcountContext();
 
9583
  return __pyx_r;
 
9584
}
 
9585
 
 
9586
/* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":65
 
9587
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 
9588
 *         # -- the details of this may change.
 
9589
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 
9590
 *             # This implementation of getbuffer is geared towards Cython
 
9591
 *             # requirements, and does not yet fullfill the PEP.
 
9592
 */
 
9593
 
 
9594
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 
9595
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
 
9596
  int __pyx_v_copy_shape;
 
9597
  int __pyx_v_i;
 
9598
  int __pyx_v_ndim;
 
9599
  int __pyx_v_endian_detector;
 
9600
  int __pyx_v_little_endian;
 
9601
  int __pyx_v_t;
 
9602
  char *__pyx_v_f;
 
9603
  PyArray_Descr *__pyx_v_descr = 0;
 
9604
  int __pyx_v_offset;
 
9605
  int __pyx_v_hasfields;
 
9606
  int __pyx_r;
 
9607
  int __pyx_t_1;
 
9608
  PyObject *__pyx_t_2 = NULL;
 
9609
  PyObject *__pyx_t_3 = NULL;
 
9610
  int __pyx_t_4;
 
9611
  int __pyx_t_5;
 
9612
  int __pyx_t_6;
 
9613
  char *__pyx_t_7;
 
9614
  __Pyx_SetupRefcountContext("__getbuffer__");
 
9615
  if (__pyx_v_info == NULL) return 0;
 
9616
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
 
9617
  __Pyx_GIVEREF(__pyx_v_info->obj);
 
9618
 
 
9619
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":71
 
9620
 *             # of flags
 
9621
 *             cdef int copy_shape, i, ndim
 
9622
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 
9623
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 
9624
 * 
 
9625
 */
 
9626
  __pyx_v_endian_detector = 1;
 
9627
 
 
9628
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":72
 
9629
 *             cdef int copy_shape, i, ndim
 
9630
 *             cdef int endian_detector = 1
 
9631
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 
9632
 * 
 
9633
 *             ndim = PyArray_NDIM(self)
 
9634
 */
 
9635
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
 
9636
 
 
9637
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":74
 
9638
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 
9639
 * 
 
9640
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 
9641
 * 
 
9642
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 
9643
 */
 
9644
  __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));
 
9645
 
 
9646
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":76
 
9647
 *             ndim = PyArray_NDIM(self)
 
9648
 * 
 
9649
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 
9650
 *                 copy_shape = 1
 
9651
 *             else:
 
9652
 */
 
9653
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
 
9654
  if (__pyx_t_1) {
 
9655
 
 
9656
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":77
 
9657
 * 
 
9658
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 
9659
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 
9660
 *             else:
 
9661
 *                 copy_shape = 0
 
9662
 */
 
9663
    __pyx_v_copy_shape = 1;
 
9664
    goto __pyx_L5;
 
9665
  }
 
9666
  /*else*/ {
 
9667
 
 
9668
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":79
 
9669
 *                 copy_shape = 1
 
9670
 *             else:
 
9671
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 
9672
 * 
 
9673
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 
9674
 */
 
9675
    __pyx_v_copy_shape = 0;
 
9676
  }
 
9677
  __pyx_L5:;
 
9678
 
 
9679
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":81
 
9680
 *                 copy_shape = 0
 
9681
 * 
 
9682
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 
9683
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 
9684
 *                 raise ValueError("ndarray is not C contiguous")
 
9685
 */
 
9686
  if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) {
 
9687
 
 
9688
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":82
 
9689
 * 
 
9690
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 
9691
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 
9692
 *                 raise ValueError("ndarray is not C contiguous")
 
9693
 * 
 
9694
 */
 
9695
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
 
9696
  } else {
 
9697
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
 
9698
  }
 
9699
  if (__pyx_t_1) {
 
9700
 
 
9701
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":83
 
9702
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 
9703
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 
9704
 *                 raise ValueError("ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 
9705
 * 
 
9706
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 
9707
 */
 
9708
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9709
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
9710
    __Pyx_INCREF(__pyx_kp_1);
 
9711
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1);
 
9712
    __Pyx_GIVEREF(__pyx_kp_1);
 
9713
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9714
    __Pyx_GOTREF(__pyx_t_3);
 
9715
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
9716
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
9717
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
9718
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9719
    goto __pyx_L6;
 
9720
  }
 
9721
  __pyx_L6:;
 
9722
 
 
9723
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":85
 
9724
 *                 raise ValueError("ndarray is not C contiguous")
 
9725
 * 
 
9726
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 
9727
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 
9728
 *                 raise ValueError("ndarray is not Fortran contiguous")
 
9729
 */
 
9730
  if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) {
 
9731
 
 
9732
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":86
 
9733
 * 
 
9734
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 
9735
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 
9736
 *                 raise ValueError("ndarray is not Fortran contiguous")
 
9737
 * 
 
9738
 */
 
9739
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
 
9740
  } else {
 
9741
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
 
9742
  }
 
9743
  if (__pyx_t_1) {
 
9744
 
 
9745
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":87
 
9746
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 
9747
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 
9748
 *                 raise ValueError("ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 
9749
 * 
 
9750
 *             info.buf = PyArray_DATA(self)
 
9751
 */
 
9752
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9753
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
9754
    __Pyx_INCREF(__pyx_kp_2);
 
9755
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2);
 
9756
    __Pyx_GIVEREF(__pyx_kp_2);
 
9757
    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9758
    __Pyx_GOTREF(__pyx_t_2);
 
9759
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
9760
    __Pyx_Raise(__pyx_t_2, 0, 0);
 
9761
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
9762
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
9763
    goto __pyx_L7;
 
9764
  }
 
9765
  __pyx_L7:;
 
9766
 
 
9767
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":89
 
9768
 *                 raise ValueError("ndarray is not Fortran contiguous")
 
9769
 * 
 
9770
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 
9771
 *             info.ndim = ndim
 
9772
 *             if copy_shape:
 
9773
 */
 
9774
  __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));
 
9775
 
 
9776
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":90
 
9777
 * 
 
9778
 *             info.buf = PyArray_DATA(self)
 
9779
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 
9780
 *             if copy_shape:
 
9781
 *                 # Allocate new buffer for strides and shape info. This is allocated
 
9782
 */
 
9783
  __pyx_v_info->ndim = __pyx_v_ndim;
 
9784
 
 
9785
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":91
 
9786
 *             info.buf = PyArray_DATA(self)
 
9787
 *             info.ndim = ndim
 
9788
 *             if copy_shape:             # <<<<<<<<<<<<<<
 
9789
 *                 # Allocate new buffer for strides and shape info. This is allocated
 
9790
 *                 # as one block, strides first.
 
9791
 */
 
9792
  __pyx_t_4 = __pyx_v_copy_shape;
 
9793
  if (__pyx_t_4) {
 
9794
 
 
9795
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":94
 
9796
 *                 # Allocate new buffer for strides and shape info. This is allocated
 
9797
 *                 # as one block, strides first.
 
9798
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)             # <<<<<<<<<<<<<<
 
9799
 *                 info.shape = info.strides + ndim
 
9800
 *                 for i in range(ndim):
 
9801
 */
 
9802
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2)));
 
9803
 
 
9804
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":95
 
9805
 *                 # as one block, strides first.
 
9806
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 
9807
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 
9808
 *                 for i in range(ndim):
 
9809
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 
9810
 */
 
9811
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
 
9812
 
 
9813
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":96
 
9814
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 
9815
 *                 info.shape = info.strides + ndim
 
9816
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 
9817
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 
9818
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 
9819
 */
 
9820
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) {
 
9821
      __pyx_v_i = __pyx_t_4;
 
9822
 
 
9823
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":97
 
9824
 *                 info.shape = info.strides + ndim
 
9825
 *                 for i in range(ndim):
 
9826
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 
9827
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 
9828
 *             else:
 
9829
 */
 
9830
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
 
9831
 
 
9832
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":98
 
9833
 *                 for i in range(ndim):
 
9834
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 
9835
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 
9836
 *             else:
 
9837
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 
9838
 */
 
9839
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
 
9840
    }
 
9841
    goto __pyx_L8;
 
9842
  }
 
9843
  /*else*/ {
 
9844
 
 
9845
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":100
 
9846
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 
9847
 *             else:
 
9848
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 
9849
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 
9850
 *             info.suboffsets = NULL
 
9851
 */
 
9852
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));
 
9853
 
 
9854
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":101
 
9855
 *             else:
 
9856
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 
9857
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 
9858
 *             info.suboffsets = NULL
 
9859
 *             info.itemsize = PyArray_ITEMSIZE(self)
 
9860
 */
 
9861
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
 
9862
  }
 
9863
  __pyx_L8:;
 
9864
 
 
9865
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":102
 
9866
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 
9867
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 
9868
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 
9869
 *             info.itemsize = PyArray_ITEMSIZE(self)
 
9870
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 
9871
 */
 
9872
  __pyx_v_info->suboffsets = NULL;
 
9873
 
 
9874
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":103
 
9875
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 
9876
 *             info.suboffsets = NULL
 
9877
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 
9878
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 
9879
 * 
 
9880
 */
 
9881
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));
 
9882
 
 
9883
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":104
 
9884
 *             info.suboffsets = NULL
 
9885
 *             info.itemsize = PyArray_ITEMSIZE(self)
 
9886
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 
9887
 * 
 
9888
 *             cdef int t
 
9889
 */
 
9890
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));
 
9891
 
 
9892
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":107
 
9893
 * 
 
9894
 *             cdef int t
 
9895
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 
9896
 *             cdef dtype descr = self.descr
 
9897
 *             cdef list stack
 
9898
 */
 
9899
  __pyx_v_f = NULL;
 
9900
 
 
9901
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":108
 
9902
 *             cdef int t
 
9903
 *             cdef char* f = NULL
 
9904
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 
9905
 *             cdef list stack
 
9906
 *             cdef int offset
 
9907
 */
 
9908
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
 
9909
  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;
 
9910
 
 
9911
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":112
 
9912
 *             cdef int offset
 
9913
 * 
 
9914
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 
9915
 * 
 
9916
 *             if not hasfields and not copy_shape:
 
9917
 */
 
9918
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
 
9919
 
 
9920
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":114
 
9921
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 
9922
 * 
 
9923
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 
9924
 *                 # do not call releasebuffer
 
9925
 *                 info.obj = None
 
9926
 */
 
9927
  if ((!__pyx_v_hasfields)) {
 
9928
    __pyx_t_1 = (!__pyx_v_copy_shape);
 
9929
  } else {
 
9930
    __pyx_t_1 = (!__pyx_v_hasfields);
 
9931
  }
 
9932
  if (__pyx_t_1) {
 
9933
 
 
9934
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":116
 
9935
 *             if not hasfields and not copy_shape:
 
9936
 *                 # do not call releasebuffer
 
9937
 *                 info.obj = None             # <<<<<<<<<<<<<<
 
9938
 *             else:
 
9939
 *                 # need to call releasebuffer
 
9940
 */
 
9941
    __Pyx_INCREF(Py_None);
 
9942
    __Pyx_GIVEREF(Py_None);
 
9943
    __Pyx_GOTREF(__pyx_v_info->obj);
 
9944
    __Pyx_DECREF(__pyx_v_info->obj);
 
9945
    __pyx_v_info->obj = Py_None;
 
9946
    goto __pyx_L11;
 
9947
  }
 
9948
  /*else*/ {
 
9949
 
 
9950
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":119
 
9951
 *             else:
 
9952
 *                 # need to call releasebuffer
 
9953
 *                 info.obj = self             # <<<<<<<<<<<<<<
 
9954
 * 
 
9955
 *             if not hasfields:
 
9956
 */
 
9957
    __Pyx_INCREF(__pyx_v_self);
 
9958
    __Pyx_GIVEREF(__pyx_v_self);
 
9959
    __Pyx_GOTREF(__pyx_v_info->obj);
 
9960
    __Pyx_DECREF(__pyx_v_info->obj);
 
9961
    __pyx_v_info->obj = __pyx_v_self;
 
9962
  }
 
9963
  __pyx_L11:;
 
9964
 
 
9965
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":121
 
9966
 *                 info.obj = self
 
9967
 * 
 
9968
 *             if not hasfields:             # <<<<<<<<<<<<<<
 
9969
 *                 t = descr.type_num
 
9970
 *                 if ((descr.byteorder == '>' and little_endian) or
 
9971
 */
 
9972
  __pyx_t_1 = (!__pyx_v_hasfields);
 
9973
  if (__pyx_t_1) {
 
9974
 
 
9975
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":122
 
9976
 * 
 
9977
 *             if not hasfields:
 
9978
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 
9979
 *                 if ((descr.byteorder == '>' and little_endian) or
 
9980
 *                     (descr.byteorder == '<' and not little_endian)):
 
9981
 */
 
9982
    __pyx_v_t = __pyx_v_descr->type_num;
 
9983
 
 
9984
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":123
 
9985
 *             if not hasfields:
 
9986
 *                 t = descr.type_num
 
9987
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 
9988
 *                     (descr.byteorder == '<' and not little_endian)):
 
9989
 *                     raise ValueError("Non-native byte order not supported")
 
9990
 */
 
9991
    if ((__pyx_v_descr->byteorder == '>')) {
 
9992
      __pyx_t_1 = __pyx_v_little_endian;
 
9993
    } else {
 
9994
      __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
 
9995
    }
 
9996
    if (!__pyx_t_1) {
 
9997
 
 
9998
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":124
 
9999
 *                 t = descr.type_num
 
10000
 *                 if ((descr.byteorder == '>' and little_endian) or
 
10001
 *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 
10002
 *                     raise ValueError("Non-native byte order not supported")
 
10003
 *                 if   t == NPY_BYTE:        f = "b"
 
10004
 */
 
10005
      if ((__pyx_v_descr->byteorder == '<')) {
 
10006
        __pyx_t_5 = (!__pyx_v_little_endian);
 
10007
      } else {
 
10008
        __pyx_t_5 = (__pyx_v_descr->byteorder == '<');
 
10009
      }
 
10010
      __pyx_t_6 = __pyx_t_5;
 
10011
    } else {
 
10012
      __pyx_t_6 = __pyx_t_1;
 
10013
    }
 
10014
    if (__pyx_t_6) {
 
10015
 
 
10016
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":125
 
10017
 *                 if ((descr.byteorder == '>' and little_endian) or
 
10018
 *                     (descr.byteorder == '<' and not little_endian)):
 
10019
 *                     raise ValueError("Non-native byte order not supported")             # <<<<<<<<<<<<<<
 
10020
 *                 if   t == NPY_BYTE:        f = "b"
 
10021
 *                 elif t == NPY_UBYTE:       f = "B"
 
10022
 */
 
10023
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10024
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
10025
      __Pyx_INCREF(__pyx_kp_5);
 
10026
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5);
 
10027
      __Pyx_GIVEREF(__pyx_kp_5);
 
10028
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10029
      __Pyx_GOTREF(__pyx_t_3);
 
10030
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
10031
      __Pyx_Raise(__pyx_t_3, 0, 0);
 
10032
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
10033
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10034
      goto __pyx_L13;
 
10035
    }
 
10036
    __pyx_L13:;
 
10037
 
 
10038
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":126
 
10039
 *                     (descr.byteorder == '<' and not little_endian)):
 
10040
 *                     raise ValueError("Non-native byte order not supported")
 
10041
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 
10042
 *                 elif t == NPY_UBYTE:       f = "B"
 
10043
 *                 elif t == NPY_SHORT:       f = "h"
 
10044
 */
 
10045
    switch (__pyx_v_t) {
 
10046
      case NPY_BYTE:
 
10047
      __pyx_v_f = __pyx_k_6;
 
10048
      break;
 
10049
 
 
10050
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":127
 
10051
 *                     raise ValueError("Non-native byte order not supported")
 
10052
 *                 if   t == NPY_BYTE:        f = "b"
 
10053
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 
10054
 *                 elif t == NPY_SHORT:       f = "h"
 
10055
 *                 elif t == NPY_USHORT:      f = "H"
 
10056
 */
 
10057
      case NPY_UBYTE:
 
10058
      __pyx_v_f = __pyx_k_7;
 
10059
      break;
 
10060
 
 
10061
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":128
 
10062
 *                 if   t == NPY_BYTE:        f = "b"
 
10063
 *                 elif t == NPY_UBYTE:       f = "B"
 
10064
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 
10065
 *                 elif t == NPY_USHORT:      f = "H"
 
10066
 *                 elif t == NPY_INT:         f = "i"
 
10067
 */
 
10068
      case NPY_SHORT:
 
10069
      __pyx_v_f = __pyx_k_8;
 
10070
      break;
 
10071
 
 
10072
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":129
 
10073
 *                 elif t == NPY_UBYTE:       f = "B"
 
10074
 *                 elif t == NPY_SHORT:       f = "h"
 
10075
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 
10076
 *                 elif t == NPY_INT:         f = "i"
 
10077
 *                 elif t == NPY_UINT:        f = "I"
 
10078
 */
 
10079
      case NPY_USHORT:
 
10080
      __pyx_v_f = __pyx_k_9;
 
10081
      break;
 
10082
 
 
10083
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":130
 
10084
 *                 elif t == NPY_SHORT:       f = "h"
 
10085
 *                 elif t == NPY_USHORT:      f = "H"
 
10086
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 
10087
 *                 elif t == NPY_UINT:        f = "I"
 
10088
 *                 elif t == NPY_LONG:        f = "l"
 
10089
 */
 
10090
      case NPY_INT:
 
10091
      __pyx_v_f = __pyx_k_10;
 
10092
      break;
 
10093
 
 
10094
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":131
 
10095
 *                 elif t == NPY_USHORT:      f = "H"
 
10096
 *                 elif t == NPY_INT:         f = "i"
 
10097
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 
10098
 *                 elif t == NPY_LONG:        f = "l"
 
10099
 *                 elif t == NPY_ULONG:       f = "L"
 
10100
 */
 
10101
      case NPY_UINT:
 
10102
      __pyx_v_f = __pyx_k_11;
 
10103
      break;
 
10104
 
 
10105
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":132
 
10106
 *                 elif t == NPY_INT:         f = "i"
 
10107
 *                 elif t == NPY_UINT:        f = "I"
 
10108
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 
10109
 *                 elif t == NPY_ULONG:       f = "L"
 
10110
 *                 elif t == NPY_LONGLONG:    f = "q"
 
10111
 */
 
10112
      case NPY_LONG:
 
10113
      __pyx_v_f = __pyx_k_12;
 
10114
      break;
 
10115
 
 
10116
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":133
 
10117
 *                 elif t == NPY_UINT:        f = "I"
 
10118
 *                 elif t == NPY_LONG:        f = "l"
 
10119
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 
10120
 *                 elif t == NPY_LONGLONG:    f = "q"
 
10121
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 
10122
 */
 
10123
      case NPY_ULONG:
 
10124
      __pyx_v_f = __pyx_k_13;
 
10125
      break;
 
10126
 
 
10127
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":134
 
10128
 *                 elif t == NPY_LONG:        f = "l"
 
10129
 *                 elif t == NPY_ULONG:       f = "L"
 
10130
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 
10131
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 
10132
 *                 elif t == NPY_FLOAT:       f = "f"
 
10133
 */
 
10134
      case NPY_LONGLONG:
 
10135
      __pyx_v_f = __pyx_k_14;
 
10136
      break;
 
10137
 
 
10138
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":135
 
10139
 *                 elif t == NPY_ULONG:       f = "L"
 
10140
 *                 elif t == NPY_LONGLONG:    f = "q"
 
10141
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 
10142
 *                 elif t == NPY_FLOAT:       f = "f"
 
10143
 *                 elif t == NPY_DOUBLE:      f = "d"
 
10144
 */
 
10145
      case NPY_ULONGLONG:
 
10146
      __pyx_v_f = __pyx_k_15;
 
10147
      break;
 
10148
 
 
10149
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":136
 
10150
 *                 elif t == NPY_LONGLONG:    f = "q"
 
10151
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 
10152
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 
10153
 *                 elif t == NPY_DOUBLE:      f = "d"
 
10154
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 
10155
 */
 
10156
      case NPY_FLOAT:
 
10157
      __pyx_v_f = __pyx_k_16;
 
10158
      break;
 
10159
 
 
10160
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":137
 
10161
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 
10162
 *                 elif t == NPY_FLOAT:       f = "f"
 
10163
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 
10164
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 
10165
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 
10166
 */
 
10167
      case NPY_DOUBLE:
 
10168
      __pyx_v_f = __pyx_k_17;
 
10169
      break;
 
10170
 
 
10171
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":138
 
10172
 *                 elif t == NPY_FLOAT:       f = "f"
 
10173
 *                 elif t == NPY_DOUBLE:      f = "d"
 
10174
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 
10175
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 
10176
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 
10177
 */
 
10178
      case NPY_LONGDOUBLE:
 
10179
      __pyx_v_f = __pyx_k_18;
 
10180
      break;
 
10181
 
 
10182
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":139
 
10183
 *                 elif t == NPY_DOUBLE:      f = "d"
 
10184
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 
10185
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 
10186
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 
10187
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 
10188
 */
 
10189
      case NPY_CFLOAT:
 
10190
      __pyx_v_f = __pyx_k_19;
 
10191
      break;
 
10192
 
 
10193
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":140
 
10194
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 
10195
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 
10196
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 
10197
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 
10198
 *                 elif t == NPY_OBJECT:      f = "O"
 
10199
 */
 
10200
      case NPY_CDOUBLE:
 
10201
      __pyx_v_f = __pyx_k_20;
 
10202
      break;
 
10203
 
 
10204
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":141
 
10205
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 
10206
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 
10207
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 
10208
 *                 elif t == NPY_OBJECT:      f = "O"
 
10209
 *                 else:
 
10210
 */
 
10211
      case NPY_CLONGDOUBLE:
 
10212
      __pyx_v_f = __pyx_k_21;
 
10213
      break;
 
10214
 
 
10215
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":142
 
10216
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 
10217
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 
10218
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 
10219
 *                 else:
 
10220
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 
10221
 */
 
10222
      case NPY_OBJECT:
 
10223
      __pyx_v_f = __pyx_k_22;
 
10224
      break;
 
10225
      default:
 
10226
 
 
10227
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":144
 
10228
 *                 elif t == NPY_OBJECT:      f = "O"
 
10229
 *                 else:
 
10230
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 
10231
 *                 info.format = f
 
10232
 *                 return
 
10233
 */
 
10234
      __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10235
      __Pyx_GOTREF(__pyx_t_3);
 
10236
      __pyx_t_2 = PyNumber_Remainder(__pyx_kp_23, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10237
      __Pyx_GOTREF(__pyx_t_2);
 
10238
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
10239
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10240
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
10241
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
 
10242
      __Pyx_GIVEREF(__pyx_t_2);
 
10243
      __pyx_t_2 = 0;
 
10244
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10245
      __Pyx_GOTREF(__pyx_t_2);
 
10246
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
10247
      __Pyx_Raise(__pyx_t_2, 0, 0);
 
10248
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
10249
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10250
      break;
 
10251
    }
 
10252
 
 
10253
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":145
 
10254
 *                 else:
 
10255
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 
10256
 *                 info.format = f             # <<<<<<<<<<<<<<
 
10257
 *                 return
 
10258
 *             else:
 
10259
 */
 
10260
    __pyx_v_info->format = __pyx_v_f;
 
10261
 
 
10262
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":146
 
10263
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 
10264
 *                 info.format = f
 
10265
 *                 return             # <<<<<<<<<<<<<<
 
10266
 *             else:
 
10267
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 
10268
 */
 
10269
    __pyx_r = 0;
 
10270
    goto __pyx_L0;
 
10271
    goto __pyx_L12;
 
10272
  }
 
10273
  /*else*/ {
 
10274
 
 
10275
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":148
 
10276
 *                 return
 
10277
 *             else:
 
10278
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 
10279
 *                 info.format[0] = '^' # Native data types, manual alignment
 
10280
 *                 offset = 0
 
10281
 */
 
10282
    __pyx_v_info->format = ((char *)malloc(255));
 
10283
 
 
10284
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":149
 
10285
 *             else:
 
10286
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 
10287
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 
10288
 *                 offset = 0
 
10289
 *                 f = _util_dtypestring(descr, info.format + 1,
 
10290
 */
 
10291
    (__pyx_v_info->format[0]) = '^';
 
10292
 
 
10293
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":150
 
10294
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 
10295
 *                 info.format[0] = '^' # Native data types, manual alignment
 
10296
 *                 offset = 0             # <<<<<<<<<<<<<<
 
10297
 *                 f = _util_dtypestring(descr, info.format + 1,
 
10298
 *                                       info.format + _buffer_format_string_len,
 
10299
 */
 
10300
    __pyx_v_offset = 0;
 
10301
 
 
10302
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":153
 
10303
 *                 f = _util_dtypestring(descr, info.format + 1,
 
10304
 *                                       info.format + _buffer_format_string_len,
 
10305
 *                                       &offset)             # <<<<<<<<<<<<<<
 
10306
 *                 f[0] = 0 # Terminate format string
 
10307
 * 
 
10308
 */
 
10309
    __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10310
    __pyx_v_f = __pyx_t_7;
 
10311
 
 
10312
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":154
 
10313
 *                                       info.format + _buffer_format_string_len,
 
10314
 *                                       &offset)
 
10315
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 
10316
 * 
 
10317
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 
10318
 */
 
10319
    (__pyx_v_f[0]) = 0;
 
10320
  }
 
10321
  __pyx_L12:;
 
10322
 
 
10323
  __pyx_r = 0;
 
10324
  goto __pyx_L0;
 
10325
  __pyx_L1_error:;
 
10326
  __Pyx_XDECREF(__pyx_t_2);
 
10327
  __Pyx_XDECREF(__pyx_t_3);
 
10328
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__");
 
10329
  __pyx_r = -1;
 
10330
  __Pyx_GOTREF(__pyx_v_info->obj);
 
10331
  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
 
10332
  goto __pyx_L2;
 
10333
  __pyx_L0:;
 
10334
  if (__pyx_v_info->obj == Py_None) {
 
10335
    __Pyx_GOTREF(Py_None);
 
10336
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
 
10337
  }
 
10338
  __pyx_L2:;
 
10339
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
 
10340
  __Pyx_FinishRefcountContext();
 
10341
  return __pyx_r;
 
10342
}
 
10343
 
 
10344
/* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":156
 
10345
 *                 f[0] = 0 # Terminate format string
 
10346
 * 
 
10347
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 
10348
 *             if PyArray_HASFIELDS(self):
 
10349
 *                 stdlib.free(info.format)
 
10350
 */
 
10351
 
 
10352
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
 
10353
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
 
10354
  int __pyx_t_1;
 
10355
  int __pyx_t_2;
 
10356
  __Pyx_SetupRefcountContext("__releasebuffer__");
 
10357
 
 
10358
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":157
 
10359
 * 
 
10360
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 
10361
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 
10362
 *                 stdlib.free(info.format)
 
10363
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 
10364
 */
 
10365
  __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self));
 
10366
  if (__pyx_t_1) {
 
10367
 
 
10368
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":158
 
10369
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 
10370
 *             if PyArray_HASFIELDS(self):
 
10371
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 
10372
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 
10373
 *                 stdlib.free(info.strides)
 
10374
 */
 
10375
    free(__pyx_v_info->format);
 
10376
    goto __pyx_L5;
 
10377
  }
 
10378
  __pyx_L5:;
 
10379
 
 
10380
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":159
 
10381
 *             if PyArray_HASFIELDS(self):
 
10382
 *                 stdlib.free(info.format)
 
10383
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 
10384
 *                 stdlib.free(info.strides)
 
10385
 *                 # info.shape was stored after info.strides in the same block
 
10386
 */
 
10387
  __pyx_t_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
 
10388
  if (__pyx_t_2) {
 
10389
 
 
10390
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":160
 
10391
 *                 stdlib.free(info.format)
 
10392
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 
10393
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 
10394
 *                 # info.shape was stored after info.strides in the same block
 
10395
 * 
 
10396
 */
 
10397
    free(__pyx_v_info->strides);
 
10398
    goto __pyx_L6;
 
10399
  }
 
10400
  __pyx_L6:;
 
10401
 
 
10402
  __Pyx_FinishRefcountContext();
 
10403
}
 
10404
 
 
10405
/* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":277
 
10406
 * ctypedef npy_cdouble     complex_t
 
10407
 * 
 
10408
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 
10409
 *     # Recursive utility function used in __getbuffer__ to get format
 
10410
 *     # string. The new location in the format string is returned.
 
10411
 */
 
10412
 
 
10413
static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
 
10414
  PyArray_Descr *__pyx_v_child;
 
10415
  PyObject *__pyx_v_i;
 
10416
  int __pyx_v_endian_detector;
 
10417
  int __pyx_v_little_endian;
 
10418
  PyObject *__pyx_v_new_offset;
 
10419
  PyObject *__pyx_v_t;
 
10420
  char *__pyx_r;
 
10421
  PyObject *__pyx_1 = 0;
 
10422
  Py_ssize_t __pyx_t_1;
 
10423
  PyObject *__pyx_t_2 = NULL;
 
10424
  PyObject *__pyx_t_3 = NULL;
 
10425
  PyObject *__pyx_t_4 = NULL;
 
10426
  PyObject *__pyx_t_5 = NULL;
 
10427
  int __pyx_t_6;
 
10428
  int __pyx_t_7;
 
10429
  int __pyx_t_8;
 
10430
  char *__pyx_t_9;
 
10431
  __Pyx_SetupRefcountContext("_util_dtypestring");
 
10432
  __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None);
 
10433
  __pyx_v_i = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
10434
  __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None);
 
10435
  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);
 
10436
 
 
10437
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":284
 
10438
 *     cdef int delta_offset
 
10439
 *     cdef tuple i
 
10440
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 
10441
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 
10442
 * 
 
10443
 */
 
10444
  __pyx_v_endian_detector = 1;
 
10445
 
 
10446
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":285
 
10447
 *     cdef tuple i
 
10448
 *     cdef int endian_detector = 1
 
10449
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 
10450
 * 
 
10451
 *     for i in descr.fields.itervalues():
 
10452
 */
 
10453
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
 
10454
 
 
10455
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":287
 
10456
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 
10457
 * 
 
10458
 *     for i in descr.fields.itervalues():             # <<<<<<<<<<<<<<
 
10459
 *         child = i[0]
 
10460
 *         new_offset = i[1]
 
10461
 */
 
10462
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10463
  __Pyx_GOTREF(__pyx_t_2);
 
10464
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10465
  __Pyx_GOTREF(__pyx_t_3);
 
10466
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
10467
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
 
10468
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
 
10469
  } else {
 
10470
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10471
    __Pyx_GOTREF(__pyx_t_2);
 
10472
  }
 
10473
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
10474
  for (;;) {
 
10475
    if (likely(PyList_CheckExact(__pyx_t_2))) {
 
10476
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
 
10477
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
 
10478
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
 
10479
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
 
10480
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
 
10481
    } else {
 
10482
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
 
10483
      if (!__pyx_t_3) {
 
10484
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10485
        break;
 
10486
      }
 
10487
      __Pyx_GOTREF(__pyx_t_3);
 
10488
    }
 
10489
    if (!(likely(PyTuple_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10490
    __Pyx_DECREF(((PyObject *)__pyx_v_i));
 
10491
    __pyx_v_i = ((PyObject *)__pyx_t_3);
 
10492
    __pyx_t_3 = 0;
 
10493
 
 
10494
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":288
 
10495
 * 
 
10496
 *     for i in descr.fields.itervalues():
 
10497
 *         child = i[0]             # <<<<<<<<<<<<<<
 
10498
 *         new_offset = i[1]
 
10499
 * 
 
10500
 */
 
10501
    __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10502
    __Pyx_GOTREF(__pyx_1);
 
10503
    if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10504
    __Pyx_DECREF(((PyObject *)__pyx_v_child));
 
10505
    __pyx_v_child = ((PyArray_Descr *)__pyx_1);
 
10506
    __pyx_1 = 0;
 
10507
 
 
10508
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":289
 
10509
 *     for i in descr.fields.itervalues():
 
10510
 *         child = i[0]
 
10511
 *         new_offset = i[1]             # <<<<<<<<<<<<<<
 
10512
 * 
 
10513
 *         if (end - f) - (new_offset - offset[0]) < 15:
 
10514
 */
 
10515
    __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_i), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10516
    __Pyx_GOTREF(__pyx_1);
 
10517
    __Pyx_DECREF(__pyx_v_new_offset);
 
10518
    __pyx_v_new_offset = __pyx_1;
 
10519
    __pyx_1 = 0;
 
10520
 
 
10521
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":291
 
10522
 *         new_offset = i[1]
 
10523
 * 
 
10524
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 
10525
 *             raise RuntimeError("Format string allocated too short, see comment in numpy.pxd")
 
10526
 * 
 
10527
 */
 
10528
    __pyx_t_3 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10529
    __Pyx_GOTREF(__pyx_t_3);
 
10530
    __pyx_t_4 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10531
    __Pyx_GOTREF(__pyx_t_4);
 
10532
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10533
    __Pyx_GOTREF(__pyx_t_5);
 
10534
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10535
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10536
    __Pyx_GOTREF(__pyx_t_4);
 
10537
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
10538
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10539
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10540
    __Pyx_GOTREF(__pyx_t_5);
 
10541
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10542
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10543
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10544
    if (__pyx_t_6) {
 
10545
 
 
10546
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":292
 
10547
 * 
 
10548
 *         if (end - f) - (new_offset - offset[0]) < 15:
 
10549
 *             raise RuntimeError("Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 
10550
 * 
 
10551
 *         if ((child.byteorder == '>' and little_endian) or
 
10552
 */
 
10553
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10554
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
10555
      __Pyx_INCREF(__pyx_kp_25);
 
10556
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_25);
 
10557
      __Pyx_GIVEREF(__pyx_kp_25);
 
10558
      __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10559
      __Pyx_GOTREF(__pyx_t_4);
 
10560
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
10561
      __Pyx_Raise(__pyx_t_4, 0, 0);
 
10562
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10563
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10564
      goto __pyx_L5;
 
10565
    }
 
10566
    __pyx_L5:;
 
10567
 
 
10568
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":294
 
10569
 *             raise RuntimeError("Format string allocated too short, see comment in numpy.pxd")
 
10570
 * 
 
10571
 *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 
10572
 *             (child.byteorder == '<' and not little_endian)):
 
10573
 *             raise ValueError("Non-native byte order not supported")
 
10574
 */
 
10575
    if ((__pyx_v_child->byteorder == '>')) {
 
10576
      __pyx_t_6 = __pyx_v_little_endian;
 
10577
    } else {
 
10578
      __pyx_t_6 = (__pyx_v_child->byteorder == '>');
 
10579
    }
 
10580
    if (!__pyx_t_6) {
 
10581
 
 
10582
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":295
 
10583
 * 
 
10584
 *         if ((child.byteorder == '>' and little_endian) or
 
10585
 *             (child.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 
10586
 *             raise ValueError("Non-native byte order not supported")
 
10587
 *             # One could encode it in the format string and have Cython
 
10588
 */
 
10589
      if ((__pyx_v_child->byteorder == '<')) {
 
10590
        __pyx_t_7 = (!__pyx_v_little_endian);
 
10591
      } else {
 
10592
        __pyx_t_7 = (__pyx_v_child->byteorder == '<');
 
10593
      }
 
10594
      __pyx_t_8 = __pyx_t_7;
 
10595
    } else {
 
10596
      __pyx_t_8 = __pyx_t_6;
 
10597
    }
 
10598
    if (__pyx_t_8) {
 
10599
 
 
10600
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":296
 
10601
 *         if ((child.byteorder == '>' and little_endian) or
 
10602
 *             (child.byteorder == '<' and not little_endian)):
 
10603
 *             raise ValueError("Non-native byte order not supported")             # <<<<<<<<<<<<<<
 
10604
 *             # One could encode it in the format string and have Cython
 
10605
 *             # complain instead, BUT: < and > in format strings also imply
 
10606
 */
 
10607
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10608
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
10609
      __Pyx_INCREF(__pyx_kp_28);
 
10610
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_28);
 
10611
      __Pyx_GIVEREF(__pyx_kp_28);
 
10612
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10613
      __Pyx_GOTREF(__pyx_t_5);
 
10614
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
10615
      __Pyx_Raise(__pyx_t_5, 0, 0);
 
10616
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10617
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10618
      goto __pyx_L6;
 
10619
    }
 
10620
    __pyx_L6:;
 
10621
 
 
10622
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":306
 
10623
 * 
 
10624
 *         # Output padding bytes
 
10625
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 
10626
 *             f[0] = 120 # "x"; pad byte
 
10627
 *             f += 1
 
10628
 */
 
10629
    while (1) {
 
10630
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10631
      __Pyx_GOTREF(__pyx_t_5);
 
10632
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10633
      __Pyx_GOTREF(__pyx_t_4);
 
10634
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10635
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10636
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10637
      if (!__pyx_t_8) break;
 
10638
 
 
10639
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":307
 
10640
 *         # Output padding bytes
 
10641
 *         while offset[0] < new_offset:
 
10642
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 
10643
 *             f += 1
 
10644
 *             offset[0] += 1
 
10645
 */
 
10646
      (__pyx_v_f[0]) = 120;
 
10647
 
 
10648
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":308
 
10649
 *         while offset[0] < new_offset:
 
10650
 *             f[0] = 120 # "x"; pad byte
 
10651
 *             f += 1             # <<<<<<<<<<<<<<
 
10652
 *             offset[0] += 1
 
10653
 * 
 
10654
 */
 
10655
      __pyx_v_f += 1;
 
10656
 
 
10657
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":309
 
10658
 *             f[0] = 120 # "x"; pad byte
 
10659
 *             f += 1
 
10660
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 
10661
 * 
 
10662
 *         offset[0] += child.itemsize
 
10663
 */
 
10664
      (__pyx_v_offset[0]) += 1;
 
10665
    }
 
10666
 
 
10667
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":311
 
10668
 *             offset[0] += 1
 
10669
 * 
 
10670
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 
10671
 * 
 
10672
 *         if not PyDataType_HASFIELDS(child):
 
10673
 */
 
10674
    (__pyx_v_offset[0]) += __pyx_v_child->elsize;
 
10675
 
 
10676
    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":313
 
10677
 *         offset[0] += child.itemsize
 
10678
 * 
 
10679
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 
10680
 *             t = child.type_num
 
10681
 *             if end - f < 5:
 
10682
 */
 
10683
    __pyx_t_8 = (!PyDataType_HASFIELDS(__pyx_v_child));
 
10684
    if (__pyx_t_8) {
 
10685
 
 
10686
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":314
 
10687
 * 
 
10688
 *         if not PyDataType_HASFIELDS(child):
 
10689
 *             t = child.type_num             # <<<<<<<<<<<<<<
 
10690
 *             if end - f < 5:
 
10691
 *                 raise RuntimeError("Format string allocated too short.")
 
10692
 */
 
10693
      __pyx_t_4 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10694
      __Pyx_GOTREF(__pyx_t_4);
 
10695
      __Pyx_DECREF(__pyx_v_t);
 
10696
      __pyx_v_t = __pyx_t_4;
 
10697
      __pyx_t_4 = 0;
 
10698
 
 
10699
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":315
 
10700
 *         if not PyDataType_HASFIELDS(child):
 
10701
 *             t = child.type_num
 
10702
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 
10703
 *                 raise RuntimeError("Format string allocated too short.")
 
10704
 * 
 
10705
 */
 
10706
      __pyx_t_8 = ((__pyx_v_end - __pyx_v_f) < 5);
 
10707
      if (__pyx_t_8) {
 
10708
 
 
10709
        /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":316
 
10710
 *             t = child.type_num
 
10711
 *             if end - f < 5:
 
10712
 *                 raise RuntimeError("Format string allocated too short.")             # <<<<<<<<<<<<<<
 
10713
 * 
 
10714
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 
10715
 */
 
10716
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10717
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
10718
        __Pyx_INCREF(__pyx_kp_29);
 
10719
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_29);
 
10720
        __Pyx_GIVEREF(__pyx_kp_29);
 
10721
        __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10722
        __Pyx_GOTREF(__pyx_t_5);
 
10723
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
10724
        __Pyx_Raise(__pyx_t_5, 0, 0);
 
10725
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10726
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10727
        goto __pyx_L10;
 
10728
      }
 
10729
      __pyx_L10:;
 
10730
 
 
10731
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":319
 
10732
 * 
 
10733
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 
10734
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 
10735
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 
10736
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 
10737
 */
 
10738
      __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10739
      __Pyx_GOTREF(__pyx_t_5);
 
10740
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10741
      __Pyx_GOTREF(__pyx_t_4);
 
10742
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10743
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10744
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10745
      if (__pyx_t_8) {
 
10746
        (__pyx_v_f[0]) = 98;
 
10747
        goto __pyx_L11;
 
10748
      }
 
10749
 
 
10750
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":320
 
10751
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 
10752
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 
10753
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 
10754
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 
10755
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 
10756
 */
 
10757
      __pyx_t_4 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10758
      __Pyx_GOTREF(__pyx_t_4);
 
10759
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10760
      __Pyx_GOTREF(__pyx_t_5);
 
10761
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10762
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10763
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10764
      if (__pyx_t_8) {
 
10765
        (__pyx_v_f[0]) = 66;
 
10766
        goto __pyx_L11;
 
10767
      }
 
10768
 
 
10769
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":321
 
10770
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 
10771
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 
10772
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 
10773
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 
10774
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 
10775
 */
 
10776
      __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10777
      __Pyx_GOTREF(__pyx_t_5);
 
10778
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10779
      __Pyx_GOTREF(__pyx_t_4);
 
10780
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10781
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10782
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10783
      if (__pyx_t_8) {
 
10784
        (__pyx_v_f[0]) = 104;
 
10785
        goto __pyx_L11;
 
10786
      }
 
10787
 
 
10788
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":322
 
10789
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 
10790
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 
10791
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 
10792
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 
10793
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 
10794
 */
 
10795
      __pyx_t_4 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10796
      __Pyx_GOTREF(__pyx_t_4);
 
10797
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10798
      __Pyx_GOTREF(__pyx_t_5);
 
10799
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10800
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10801
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10802
      if (__pyx_t_8) {
 
10803
        (__pyx_v_f[0]) = 72;
 
10804
        goto __pyx_L11;
 
10805
      }
 
10806
 
 
10807
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":323
 
10808
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 
10809
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 
10810
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 
10811
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 
10812
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 
10813
 */
 
10814
      __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10815
      __Pyx_GOTREF(__pyx_t_5);
 
10816
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10817
      __Pyx_GOTREF(__pyx_t_4);
 
10818
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10819
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10820
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10821
      if (__pyx_t_8) {
 
10822
        (__pyx_v_f[0]) = 105;
 
10823
        goto __pyx_L11;
 
10824
      }
 
10825
 
 
10826
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":324
 
10827
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 
10828
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 
10829
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 
10830
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 
10831
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 
10832
 */
 
10833
      __pyx_t_4 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10834
      __Pyx_GOTREF(__pyx_t_4);
 
10835
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10836
      __Pyx_GOTREF(__pyx_t_5);
 
10837
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10838
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10839
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10840
      if (__pyx_t_8) {
 
10841
        (__pyx_v_f[0]) = 73;
 
10842
        goto __pyx_L11;
 
10843
      }
 
10844
 
 
10845
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":325
 
10846
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 
10847
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 
10848
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 
10849
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 
10850
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 
10851
 */
 
10852
      __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10853
      __Pyx_GOTREF(__pyx_t_5);
 
10854
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10855
      __Pyx_GOTREF(__pyx_t_4);
 
10856
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10857
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10858
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10859
      if (__pyx_t_8) {
 
10860
        (__pyx_v_f[0]) = 108;
 
10861
        goto __pyx_L11;
 
10862
      }
 
10863
 
 
10864
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":326
 
10865
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 
10866
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 
10867
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 
10868
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 
10869
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 
10870
 */
 
10871
      __pyx_t_4 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10872
      __Pyx_GOTREF(__pyx_t_4);
 
10873
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10874
      __Pyx_GOTREF(__pyx_t_5);
 
10875
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10876
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10877
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10878
      if (__pyx_t_8) {
 
10879
        (__pyx_v_f[0]) = 76;
 
10880
        goto __pyx_L11;
 
10881
      }
 
10882
 
 
10883
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":327
 
10884
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 
10885
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 
10886
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 
10887
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 
10888
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 
10889
 */
 
10890
      __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10891
      __Pyx_GOTREF(__pyx_t_5);
 
10892
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10893
      __Pyx_GOTREF(__pyx_t_4);
 
10894
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10895
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10896
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10897
      if (__pyx_t_8) {
 
10898
        (__pyx_v_f[0]) = 113;
 
10899
        goto __pyx_L11;
 
10900
      }
 
10901
 
 
10902
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":328
 
10903
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 
10904
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 
10905
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 
10906
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 
10907
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 
10908
 */
 
10909
      __pyx_t_4 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10910
      __Pyx_GOTREF(__pyx_t_4);
 
10911
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10912
      __Pyx_GOTREF(__pyx_t_5);
 
10913
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10914
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10915
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10916
      if (__pyx_t_8) {
 
10917
        (__pyx_v_f[0]) = 81;
 
10918
        goto __pyx_L11;
 
10919
      }
 
10920
 
 
10921
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":329
 
10922
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 
10923
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 
10924
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 
10925
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 
10926
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 
10927
 */
 
10928
      __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10929
      __Pyx_GOTREF(__pyx_t_5);
 
10930
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10931
      __Pyx_GOTREF(__pyx_t_4);
 
10932
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10933
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10934
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10935
      if (__pyx_t_8) {
 
10936
        (__pyx_v_f[0]) = 102;
 
10937
        goto __pyx_L11;
 
10938
      }
 
10939
 
 
10940
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":330
 
10941
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 
10942
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 
10943
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 
10944
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 
10945
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 
10946
 */
 
10947
      __pyx_t_4 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10948
      __Pyx_GOTREF(__pyx_t_4);
 
10949
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10950
      __Pyx_GOTREF(__pyx_t_5);
 
10951
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10952
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10953
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10954
      if (__pyx_t_8) {
 
10955
        (__pyx_v_f[0]) = 100;
 
10956
        goto __pyx_L11;
 
10957
      }
 
10958
 
 
10959
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":331
 
10960
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 
10961
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 
10962
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 
10963
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 
10964
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 
10965
 */
 
10966
      __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10967
      __Pyx_GOTREF(__pyx_t_5);
 
10968
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10969
      __Pyx_GOTREF(__pyx_t_4);
 
10970
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10971
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10972
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10973
      if (__pyx_t_8) {
 
10974
        (__pyx_v_f[0]) = 103;
 
10975
        goto __pyx_L11;
 
10976
      }
 
10977
 
 
10978
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":332
 
10979
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 
10980
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 
10981
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 
10982
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 
10983
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 
10984
 */
 
10985
      __pyx_t_4 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10986
      __Pyx_GOTREF(__pyx_t_4);
 
10987
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10988
      __Pyx_GOTREF(__pyx_t_5);
 
10989
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
10990
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
10991
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
10992
      if (__pyx_t_8) {
 
10993
        (__pyx_v_f[0]) = 90;
 
10994
        (__pyx_v_f[1]) = 102;
 
10995
        __pyx_v_f += 1;
 
10996
        goto __pyx_L11;
 
10997
      }
 
10998
 
 
10999
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":333
 
11000
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 
11001
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 
11002
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 
11003
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 
11004
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 
11005
 */
 
11006
      __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11007
      __Pyx_GOTREF(__pyx_t_5);
 
11008
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11009
      __Pyx_GOTREF(__pyx_t_4);
 
11010
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
11011
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11012
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
11013
      if (__pyx_t_8) {
 
11014
        (__pyx_v_f[0]) = 90;
 
11015
        (__pyx_v_f[1]) = 100;
 
11016
        __pyx_v_f += 1;
 
11017
        goto __pyx_L11;
 
11018
      }
 
11019
 
 
11020
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":334
 
11021
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 
11022
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 
11023
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 
11024
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 
11025
 *             else:
 
11026
 */
 
11027
      __pyx_t_4 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11028
      __Pyx_GOTREF(__pyx_t_4);
 
11029
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11030
      __Pyx_GOTREF(__pyx_t_5);
 
11031
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
11032
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11033
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
11034
      if (__pyx_t_8) {
 
11035
        (__pyx_v_f[0]) = 90;
 
11036
        (__pyx_v_f[1]) = 103;
 
11037
        __pyx_v_f += 1;
 
11038
        goto __pyx_L11;
 
11039
      }
 
11040
 
 
11041
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":335
 
11042
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 
11043
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 
11044
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 
11045
 *             else:
 
11046
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 
11047
 */
 
11048
      __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11049
      __Pyx_GOTREF(__pyx_t_5);
 
11050
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11051
      __Pyx_GOTREF(__pyx_t_4);
 
11052
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
11053
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11054
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
11055
      if (__pyx_t_8) {
 
11056
        (__pyx_v_f[0]) = 79;
 
11057
        goto __pyx_L11;
 
11058
      }
 
11059
      /*else*/ {
 
11060
 
 
11061
        /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":337
 
11062
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 
11063
 *             else:
 
11064
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 
11065
 *             f += 1
 
11066
 *         else:
 
11067
 */
 
11068
        __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, __pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11069
        __Pyx_GOTREF(__pyx_t_4);
 
11070
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11071
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
11072
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
 
11073
        __Pyx_GIVEREF(__pyx_t_4);
 
11074
        __pyx_t_4 = 0;
 
11075
        __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11076
        __Pyx_GOTREF(__pyx_t_4);
 
11077
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
11078
        __Pyx_Raise(__pyx_t_4, 0, 0);
 
11079
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
11080
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11081
      }
 
11082
      __pyx_L11:;
 
11083
 
 
11084
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":338
 
11085
 *             else:
 
11086
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 
11087
 *             f += 1             # <<<<<<<<<<<<<<
 
11088
 *         else:
 
11089
 *             # Cython ignores struct boundary information ("T{...}"),
 
11090
 */
 
11091
      __pyx_v_f += 1;
 
11092
      goto __pyx_L9;
 
11093
    }
 
11094
    /*else*/ {
 
11095
 
 
11096
      /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":342
 
11097
 *             # Cython ignores struct boundary information ("T{...}"),
 
11098
 *             # so don't output it
 
11099
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 
11100
 *     return f
 
11101
 * 
 
11102
 */
 
11103
      __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11104
      __pyx_v_f = __pyx_t_9;
 
11105
    }
 
11106
    __pyx_L9:;
 
11107
  }
 
11108
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
11109
 
 
11110
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/numpy.pxd":343
 
11111
 *             # so don't output it
 
11112
 *             f = _util_dtypestring(child, f, end, offset)
 
11113
 *     return f             # <<<<<<<<<<<<<<
 
11114
 * 
 
11115
 */
 
11116
  __pyx_r = __pyx_v_f;
 
11117
  goto __pyx_L0;
 
11118
 
 
11119
  __pyx_r = 0;
 
11120
  goto __pyx_L0;
 
11121
  __pyx_L1_error:;
 
11122
  __Pyx_XDECREF(__pyx_1);
 
11123
  __Pyx_XDECREF(__pyx_t_2);
 
11124
  __Pyx_XDECREF(__pyx_t_3);
 
11125
  __Pyx_XDECREF(__pyx_t_4);
 
11126
  __Pyx_XDECREF(__pyx_t_5);
 
11127
  __Pyx_AddTraceback("numpy._util_dtypestring");
 
11128
  __pyx_r = NULL;
 
11129
  __pyx_L0:;
 
11130
  __Pyx_DECREF((PyObject *)__pyx_v_child);
 
11131
  __Pyx_DECREF(__pyx_v_i);
 
11132
  __Pyx_DECREF(__pyx_v_new_offset);
 
11133
  __Pyx_DECREF(__pyx_v_t);
 
11134
  __Pyx_FinishRefcountContext();
 
11135
  return __pyx_r;
 
11136
}
 
11137
 
 
11138
static struct PyMethodDef __pyx_methods[] = {
 
11139
  {__Pyx_NAMESTR("map_indices"), (PyCFunction)__pyx_pf_7tseries_map_indices, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_map_indices)},
 
11140
  {__Pyx_NAMESTR("match"), (PyCFunction)__pyx_pf_7tseries_match, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_match)},
 
11141
  {__Pyx_NAMESTR("reindex"), (PyCFunction)__pyx_pf_7tseries_reindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_reindex)},
 
11142
  {__Pyx_NAMESTR("reindexObj"), (PyCFunction)__pyx_pf_7tseries_reindexObj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_reindexObj)},
 
11143
  {__Pyx_NAMESTR("reindexObject"), (PyCFunction)__pyx_pf_7tseries_reindexObject, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_reindexObject)},
 
11144
  {__Pyx_NAMESTR("getFillVec"), (PyCFunction)__pyx_pf_7tseries_getFillVec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
 
11145
  {__Pyx_NAMESTR("getMergeVec"), (PyCFunction)__pyx_pf_7tseries_getMergeVec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
 
11146
  {__Pyx_NAMESTR("isnull"), (PyCFunction)__pyx_pf_7tseries_isnull, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_isnull)},
 
11147
  {__Pyx_NAMESTR("notnull"), (PyCFunction)__pyx_pf_7tseries_notnull, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_notnull)},
 
11148
  {__Pyx_NAMESTR("reindexNew"), (PyCFunction)__pyx_pf_7tseries_reindexNew, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_reindexNew)},
 
11149
  {__Pyx_NAMESTR("combineFunc"), (PyCFunction)__pyx_pf_7tseries_combineFunc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_combineFunc)},
 
11150
  {__Pyx_NAMESTR("arrmap"), (PyCFunction)__pyx_pf_7tseries_arrmap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
 
11151
  {__Pyx_NAMESTR("groupby_withnull_old"), (PyCFunction)__pyx_pf_7tseries_groupby_withnull_old, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
 
11152
  {__Pyx_NAMESTR("groupby_withnull"), (PyCFunction)__pyx_pf_7tseries_groupby_withnull, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
 
11153
  {__Pyx_NAMESTR("groupby"), (PyCFunction)__pyx_pf_7tseries_groupby, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
 
11154
  {__Pyx_NAMESTR("groupbyfunc"), (PyCFunction)__pyx_pf_7tseries_groupbyfunc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_groupbyfunc)},
 
11155
  {0, 0, 0, 0}
 
11156
};
 
11157
 
 
11158
static void __pyx_init_filenames(void); /*proto*/
 
11159
 
 
11160
#if PY_MAJOR_VERSION >= 3
 
11161
static struct PyModuleDef __pyx_moduledef = {
 
11162
    PyModuleDef_HEAD_INIT,
 
11163
    __Pyx_NAMESTR("tseries"),
 
11164
    0, /* m_doc */
 
11165
    -1, /* m_size */
 
11166
    __pyx_methods /* m_methods */,
 
11167
    NULL, /* m_reload */
 
11168
    NULL, /* m_traverse */
 
11169
    NULL, /* m_clear */
 
11170
    NULL /* m_free */
 
11171
};
 
11172
#endif
 
11173
 
 
11174
static __Pyx_StringTabEntry __pyx_string_tab[] = {
 
11175
  {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1},
 
11176
  {&__pyx_kp_index, __pyx_k_index, sizeof(__pyx_k_index), 1, 1, 1},
 
11177
  {&__pyx_kp_A, __pyx_k_A, sizeof(__pyx_k_A), 1, 1, 1},
 
11178
  {&__pyx_kp_B, __pyx_k_B, sizeof(__pyx_k_B), 1, 1, 1},
 
11179
  {&__pyx_kp_arr, __pyx_k_arr, sizeof(__pyx_k_arr), 1, 1, 1},
 
11180
  {&__pyx_kp_idxMap, __pyx_k_idxMap, sizeof(__pyx_k_idxMap), 1, 1, 1},
 
11181
  {&__pyx_kp_oldIndex, __pyx_k_oldIndex, sizeof(__pyx_k_oldIndex), 1, 1, 1},
 
11182
  {&__pyx_kp_newIndex, __pyx_k_newIndex, sizeof(__pyx_k_newIndex), 1, 1, 1},
 
11183
  {&__pyx_kp_oldMap, __pyx_k_oldMap, sizeof(__pyx_k_oldMap), 1, 1, 1},
 
11184
  {&__pyx_kp_newMap, __pyx_k_newMap, sizeof(__pyx_k_newMap), 1, 1, 1},
 
11185
  {&__pyx_kp_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 1, 1, 1},
 
11186
  {&__pyx_kp_values, __pyx_k_values, sizeof(__pyx_k_values), 1, 1, 1},
 
11187
  {&__pyx_kp_indexMap, __pyx_k_indexMap, sizeof(__pyx_k_indexMap), 1, 1, 1},
 
11188
  {&__pyx_kp_input, __pyx_k_input, sizeof(__pyx_k_input), 1, 1, 1},
 
11189
  {&__pyx_kp_name, __pyx_k_name, sizeof(__pyx_k_name), 1, 1, 1},
 
11190
  {&__pyx_kp_ao, __pyx_k_ao, sizeof(__pyx_k_ao), 1, 1, 1},
 
11191
  {&__pyx_kp_bo, __pyx_k_bo, sizeof(__pyx_k_bo), 1, 1, 1},
 
11192
  {&__pyx_kp_aMap, __pyx_k_aMap, sizeof(__pyx_k_aMap), 1, 1, 1},
 
11193
  {&__pyx_kp_bMap, __pyx_k_bMap, sizeof(__pyx_k_bMap), 1, 1, 1},
 
11194
  {&__pyx_kp_func, __pyx_k_func, sizeof(__pyx_k_func), 1, 1, 1},
 
11195
  {&__pyx_kp_keyfunc, __pyx_k_keyfunc, sizeof(__pyx_k_keyfunc), 1, 1, 1},
 
11196
  {&__pyx_kp_applyfunc, __pyx_k_applyfunc, sizeof(__pyx_k_applyfunc), 1, 1, 1},
 
11197
  {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1},
 
11198
  {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1},
 
11199
  {&__pyx_kp_isnan, __pyx_k_isnan, sizeof(__pyx_k_isnan), 1, 1, 1},
 
11200
  {&__pyx_kp_NaN, __pyx_k_NaN, sizeof(__pyx_k_NaN), 1, 1, 1},
 
11201
  {&__pyx_kp_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 1, 1, 1},
 
11202
  {&__pyx_kp_pydatetime, __pyx_k_pydatetime, sizeof(__pyx_k_pydatetime), 0, 1, 1},
 
11203
  {&__pyx_kp_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 1, 1, 1},
 
11204
  {&__pyx_kp_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 1, 1, 1},
 
11205
  {&__pyx_kp_map_indices, __pyx_k_map_indices, sizeof(__pyx_k_map_indices), 1, 1, 1},
 
11206
  {&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1},
 
11207
  {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 1, 1, 1},
 
11208
  {&__pyx_kp_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 1, 1, 1},
 
11209
  {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1},
 
11210
  {&__pyx_kp_object_, __pyx_k_object_, sizeof(__pyx_k_object_), 1, 1, 1},
 
11211
  {&__pyx_kp_object, __pyx_k_object, sizeof(__pyx_k_object), 1, 1, 1},
 
11212
  {&__pyx_kp_33, __pyx_k_33, sizeof(__pyx_k_33), 1, 1, 1},
 
11213
  {&__pyx_kp_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 1, 1, 1},
 
11214
  {&__pyx_kp_34, __pyx_k_34, sizeof(__pyx_k_34), 1, 1, 1},
 
11215
  {&__pyx_kp_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0},
 
11216
  {&__pyx_kp_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0},
 
11217
  {&__pyx_kp_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 1, 1, 1},
 
11218
  {&__pyx_kp_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0},
 
11219
  {&__pyx_kp_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0},
 
11220
  {&__pyx_kp_isfinite, __pyx_k_isfinite, sizeof(__pyx_k_isfinite), 1, 1, 1},
 
11221
  {&__pyx_kp_isnull, __pyx_k_isnull, sizeof(__pyx_k_isnull), 1, 1, 1},
 
11222
  {&__pyx_kp_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0},
 
11223
  {&__pyx_kp_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 1, 0},
 
11224
  {&__pyx_kp_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0},
 
11225
  {&__pyx_kp_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 1, 0},
 
11226
  {&__pyx_kp_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 1, 0},
 
11227
  {&__pyx_kp_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 1, 0},
 
11228
  {&__pyx_kp_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 1, 0},
 
11229
  {&__pyx_kp_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 1, 0},
 
11230
  {&__pyx_kp_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 1, 0},
 
11231
  {&__pyx_kp_arrmap, __pyx_k_arrmap, sizeof(__pyx_k_arrmap), 1, 1, 1},
 
11232
  {&__pyx_kp_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 1, 1, 1},
 
11233
  {&__pyx_kp_any, __pyx_k_any, sizeof(__pyx_k_any), 1, 1, 1},
 
11234
  {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 0},
 
11235
  {&__pyx_kp_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 0},
 
11236
  {&__pyx_kp_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 0},
 
11237
  {&__pyx_kp_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 0},
 
11238
  {&__pyx_kp_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 0},
 
11239
  {&__pyx_kp_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 0},
 
11240
  {&__pyx_kp_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 0},
 
11241
  {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1},
 
11242
  {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1},
 
11243
  {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1},
 
11244
  {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1},
 
11245
  {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1},
 
11246
  {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1},
 
11247
  {&__pyx_kp_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 1, 1, 1},
 
11248
  {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1},
 
11249
  {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0},
 
11250
  {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0},
 
11251
  {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0},
 
11252
  {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 0},
 
11253
  {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0},
 
11254
  {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0},
 
11255
  {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0},
 
11256
  {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0},
 
11257
  {0, 0, 0, 0, 0, 0}
 
11258
};
 
11259
static int __Pyx_InitCachedBuiltins(void) {
 
11260
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_kp_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11261
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_kp_object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11262
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11263
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11264
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11265
  return 0;
 
11266
  __pyx_L1_error:;
 
11267
  return -1;
 
11268
}
 
11269
 
 
11270
static int __Pyx_InitGlobals(void) {
 
11271
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
11272
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
11273
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
11274
  return 0;
 
11275
  __pyx_L1_error:;
 
11276
  return -1;
 
11277
}
 
11278
 
 
11279
#if PY_MAJOR_VERSION < 3
 
11280
PyMODINIT_FUNC inittseries(void); /*proto*/
 
11281
PyMODINIT_FUNC inittseries(void)
 
11282
#else
 
11283
PyMODINIT_FUNC PyInit_tseries(void); /*proto*/
 
11284
PyMODINIT_FUNC PyInit_tseries(void)
 
11285
#endif
 
11286
{
 
11287
  PyObject *__pyx_1 = 0;
 
11288
  PyObject *__pyx_2 = 0;
 
11289
  PyObject *__pyx_t_1 = NULL;
 
11290
  double __pyx_t_2;
 
11291
  #ifdef CYTHON_REFNANNY
 
11292
  void* __pyx_refchk = NULL;
 
11293
  __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny");
 
11294
  if (!__Pyx_Refnanny) {
 
11295
      PyErr_Clear();
 
11296
      __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny");
 
11297
      if (!__Pyx_Refnanny)
 
11298
          Py_FatalError("failed to import refnanny module");
 
11299
  }
 
11300
  __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_tseries(void)", __LINE__, __FILE__);
 
11301
  #endif
 
11302
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11303
  /*--- Library function declarations ---*/
 
11304
  __pyx_init_filenames();
 
11305
  /*--- Threads initialization code ---*/
 
11306
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
 
11307
  #ifdef WITH_THREAD /* Python build with threading support? */
 
11308
  PyEval_InitThreads();
 
11309
  #endif
 
11310
  #endif
 
11311
  /*--- Initialize various global constants etc. ---*/
 
11312
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11313
  /*--- Module creation code ---*/
 
11314
  #if PY_MAJOR_VERSION < 3
 
11315
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("tseries"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
 
11316
  #else
 
11317
  __pyx_m = PyModule_Create(&__pyx_moduledef);
 
11318
  #endif
 
11319
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
11320
  #if PY_MAJOR_VERSION < 3
 
11321
  Py_INCREF(__pyx_m);
 
11322
  #endif
 
11323
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
 
11324
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
11325
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
11326
  if (__pyx_module_is_main_tseries) {
 
11327
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
11328
  }
 
11329
  /*--- Builtin init code ---*/
 
11330
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11331
  __pyx_skip_dispatch = 0;
 
11332
  /*--- Global init code ---*/
 
11333
  /*--- Function export code ---*/
 
11334
  /*--- Type init code ---*/
 
11335
  __pyx_ptype_7tseries_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_7tseries_dtype)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11336
  __pyx_ptype_7tseries_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_7tseries_ndarray)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11337
  __pyx_ptype_7tseries_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_7tseries_flatiter)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11338
  __pyx_ptype_7tseries_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_7tseries_broadcast)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11339
  __pyx_ptype_7tseries_datetime = __Pyx_ImportType("datetime", "datetime", sizeof(PyDateTime_DateTime)); if (unlikely(!__pyx_ptype_7tseries_datetime)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11340
  /*--- Type import code ---*/
 
11341
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11342
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11343
  /*--- Function import code ---*/
 
11344
  /*--- Execution code ---*/
 
11345
 
 
11346
  /* "pandas/lib/src/tseries.pyx":6
 
11347
 * 
 
11348
 * # initialize numpy
 
11349
 * import_array()             # <<<<<<<<<<<<<<
 
11350
 * 
 
11351
 * import numpy as np
 
11352
 */
 
11353
  import_array();
 
11354
 
 
11355
  /* "pandas/lib/src/tseries.pyx":8
 
11356
 * import_array()
 
11357
 * 
 
11358
 * import numpy as np             # <<<<<<<<<<<<<<
 
11359
 * cimport numpy as np
 
11360
 * 
 
11361
 */
 
11362
  __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11363
  __Pyx_GOTREF(__pyx_1);
 
11364
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11365
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
11366
 
 
11367
  /* "pandas/lib/src/tseries.pyx":11
 
11368
 * cimport numpy as np
 
11369
 * 
 
11370
 * isnan = np.isnan             # <<<<<<<<<<<<<<
 
11371
 * cdef double NaN = <double> np.NaN
 
11372
 * 
 
11373
 */
 
11374
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11375
  __Pyx_GOTREF(__pyx_1);
 
11376
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_isnan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11377
  __Pyx_GOTREF(__pyx_t_1);
 
11378
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
11379
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_isnan, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11380
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
11381
 
 
11382
  /* "pandas/lib/src/tseries.pyx":12
 
11383
 * 
 
11384
 * isnan = np.isnan
 
11385
 * cdef double NaN = <double> np.NaN             # <<<<<<<<<<<<<<
 
11386
 * 
 
11387
 * from datetime import datetime as pydatetime
 
11388
 */
 
11389
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11390
  __Pyx_GOTREF(__pyx_1);
 
11391
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11392
  __Pyx_GOTREF(__pyx_t_1);
 
11393
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
11394
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11395
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
11396
  __pyx_v_7tseries_NaN = ((double)__pyx_t_2);
 
11397
 
 
11398
  /* "pandas/lib/src/tseries.pyx":14
 
11399
 * cdef double NaN = <double> np.NaN
 
11400
 * 
 
11401
 * from datetime import datetime as pydatetime             # <<<<<<<<<<<<<<
 
11402
 * 
 
11403
 * from python_dict cimport *
 
11404
 */
 
11405
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11406
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
11407
  __Pyx_INCREF(__pyx_kp_datetime);
 
11408
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_datetime);
 
11409
  __Pyx_GIVEREF(__pyx_kp_datetime);
 
11410
  __pyx_1 = __Pyx_Import(__pyx_kp_datetime, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11411
  __Pyx_GOTREF(__pyx_1);
 
11412
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
11413
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_datetime); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11414
  __Pyx_GOTREF(__pyx_2);
 
11415
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_pydatetime, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11416
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
 
11417
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
11418
 
 
11419
  /* "pandas/lib/src/tseries.pyx":547
 
11420
 *     return fillVec, maskVec.astype(np.bool)
 
11421
 * 
 
11422
 * cdef double INF = <double> np.inf             # <<<<<<<<<<<<<<
 
11423
 * cdef double NEGINF = -INF
 
11424
 * 
 
11425
 */
 
11426
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11427
  __Pyx_GOTREF(__pyx_1);
 
11428
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11429
  __Pyx_GOTREF(__pyx_t_1);
 
11430
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
 
11431
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
11432
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
11433
  __pyx_v_7tseries_INF = ((double)__pyx_t_2);
 
11434
 
 
11435
  /* "pandas/lib/src/tseries.pyx":548
 
11436
 * 
 
11437
 * cdef double INF = <double> np.inf
 
11438
 * cdef double NEGINF = -INF             # <<<<<<<<<<<<<<
 
11439
 * 
 
11440
 * cdef inline _checknull(object val):
 
11441
 */
 
11442
  __pyx_v_7tseries_NEGINF = (-__pyx_v_7tseries_INF);
 
11443
 
 
11444
  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-i386.egg/Cython/Includes/stdlib.pxd":2
 
11445
 * 
 
11446
 * cdef extern from "stdlib.h" nogil:             # <<<<<<<<<<<<<<
 
11447
 *     void free(void *ptr)
 
11448
 *     void *malloc(size_t size)
 
11449
 */
 
11450
  goto __pyx_L0;
 
11451
  __pyx_L1_error:;
 
11452
  __Pyx_XDECREF(__pyx_1);
 
11453
  __Pyx_XDECREF(__pyx_2);
 
11454
  __Pyx_XDECREF(__pyx_t_1);
 
11455
  __Pyx_AddTraceback("tseries");
 
11456
  Py_DECREF(__pyx_m); __pyx_m = 0;
 
11457
  __pyx_L0:;
 
11458
  __Pyx_FinishRefcountContext();
 
11459
  #if PY_MAJOR_VERSION < 3
 
11460
  return;
 
11461
  #else
 
11462
  return __pyx_m;
 
11463
  #endif
 
11464
}
 
11465
 
 
11466
static const char *__pyx_filenames[] = {
 
11467
  "tseries.pyx",
 
11468
  "numpy.pxd",
 
11469
  "numpy.pxi",
 
11470
  "datetime.pxi",
 
11471
};
 
11472
 
 
11473
/* Runtime support code */
 
11474
 
 
11475
static void __pyx_init_filenames(void) {
 
11476
  __pyx_f = __pyx_filenames;
 
11477
}
 
11478
 
 
11479
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
 
11480
    PyObject *tmp_type, *tmp_value, *tmp_tb;
 
11481
    PyThreadState *tstate = PyThreadState_GET();
 
11482
    *type = tstate->curexc_type;
 
11483
    *value = tstate->curexc_value;
 
11484
    *tb = tstate->curexc_traceback;
 
11485
    tstate->curexc_type = 0;
 
11486
    tstate->curexc_value = 0;
 
11487
    tstate->curexc_traceback = 0;
 
11488
    PyErr_NormalizeException(type, value, tb);
 
11489
    if (PyErr_Occurred())
 
11490
        goto bad;
 
11491
    Py_INCREF(*type);
 
11492
    Py_INCREF(*value);
 
11493
    Py_INCREF(*tb);
 
11494
    tmp_type = tstate->exc_type;
 
11495
    tmp_value = tstate->exc_value;
 
11496
    tmp_tb = tstate->exc_traceback;
 
11497
    tstate->exc_type = *type;
 
11498
    tstate->exc_value = *value;
 
11499
    tstate->exc_traceback = *tb;
 
11500
    /* Make sure tstate is in a consistent state when we XDECREF
 
11501
    these objects (XDECREF may run arbitrary code). */
 
11502
    Py_XDECREF(tmp_type);
 
11503
    Py_XDECREF(tmp_value);
 
11504
    Py_XDECREF(tmp_tb);
 
11505
    return 0;
 
11506
bad:
 
11507
    Py_XDECREF(*type);
 
11508
    Py_XDECREF(*value);
 
11509
    Py_XDECREF(*tb);
 
11510
    return -1;
 
11511
}
 
11512
 
 
11513
 
 
11514
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
 
11515
    if (!type) {
 
11516
        PyErr_Format(PyExc_SystemError, "Missing type object");
 
11517
        return 0;
 
11518
    }
 
11519
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
 
11520
        return 1;
 
11521
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
 
11522
        Py_TYPE(obj)->tp_name, type->tp_name);
 
11523
    return 0;
 
11524
}
 
11525
 
 
11526
static void __Pyx_RaiseDoubleKeywordsError(
 
11527
    const char* func_name,
 
11528
    PyObject* kw_name)
 
11529
{
 
11530
    PyErr_Format(PyExc_TypeError,
 
11531
        #if PY_MAJOR_VERSION >= 3
 
11532
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
 
11533
        #else
 
11534
        "%s() got multiple values for keyword argument '%s'", func_name,
 
11535
        PyString_AS_STRING(kw_name));
 
11536
        #endif
 
11537
}
 
11538
 
 
11539
static void __Pyx_RaiseArgtupleInvalid(
 
11540
    const char* func_name,
 
11541
    int exact,
 
11542
    Py_ssize_t num_min,
 
11543
    Py_ssize_t num_max,
 
11544
    Py_ssize_t num_found)
 
11545
{
 
11546
    Py_ssize_t num_expected;
 
11547
    const char *number, *more_or_less;
 
11548
 
 
11549
    if (num_found < num_min) {
 
11550
        num_expected = num_min;
 
11551
        more_or_less = "at least";
 
11552
    } else {
 
11553
        num_expected = num_max;
 
11554
        more_or_less = "at most";
 
11555
    }
 
11556
    if (exact) {
 
11557
        more_or_less = "exactly";
 
11558
    }
 
11559
    number = (num_expected == 1) ? "" : "s";
 
11560
    PyErr_Format(PyExc_TypeError,
 
11561
        #if PY_VERSION_HEX < 0x02050000
 
11562
            "%s() takes %s %d positional argument%s (%d given)",
 
11563
        #else
 
11564
            "%s() takes %s %zd positional argument%s (%zd given)",
 
11565
        #endif
 
11566
        func_name, more_or_less, num_expected, number, num_found);
 
11567
}
 
11568
 
 
11569
static int __Pyx_ParseOptionalKeywords(
 
11570
    PyObject *kwds,
 
11571
    PyObject **argnames[],
 
11572
    PyObject *kwds2,
 
11573
    PyObject *values[],
 
11574
    Py_ssize_t num_pos_args,
 
11575
    const char* function_name)
 
11576
{
 
11577
    PyObject *key = 0, *value = 0;
 
11578
    Py_ssize_t pos = 0;
 
11579
    PyObject*** name;
 
11580
    PyObject*** first_kw_arg = argnames + num_pos_args;
 
11581
 
 
11582
    while (PyDict_Next(kwds, &pos, &key, &value)) {
 
11583
        name = first_kw_arg;
 
11584
        while (*name && (**name != key)) name++;
 
11585
        if (*name) {
 
11586
            values[name-argnames] = value;
 
11587
        } else {
 
11588
            #if PY_MAJOR_VERSION < 3
 
11589
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
 
11590
            #else
 
11591
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
 
11592
            #endif
 
11593
                goto invalid_keyword_type;
 
11594
            } else {
 
11595
                for (name = first_kw_arg; *name; name++) {
 
11596
                    #if PY_MAJOR_VERSION >= 3
 
11597
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
 
11598
                        PyUnicode_Compare(**name, key) == 0) break;
 
11599
                    #else
 
11600
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
 
11601
                        _PyString_Eq(**name, key)) break;
 
11602
                    #endif
 
11603
                }
 
11604
                if (*name) {
 
11605
                    values[name-argnames] = value;
 
11606
                } else {
 
11607
                    /* unexpected keyword found */
 
11608
                    for (name=argnames; name != first_kw_arg; name++) {
 
11609
                        if (**name == key) goto arg_passed_twice;
 
11610
                        #if PY_MAJOR_VERSION >= 3
 
11611
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
 
11612
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
 
11613
                        #else
 
11614
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
 
11615
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
 
11616
                        #endif
 
11617
                    }
 
11618
                    if (kwds2) {
 
11619
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
 
11620
                    } else {
 
11621
                        goto invalid_keyword;
 
11622
                    }
 
11623
                }
 
11624
            }
 
11625
        }
 
11626
    }
 
11627
    return 0;
 
11628
arg_passed_twice:
 
11629
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
 
11630
    goto bad;
 
11631
invalid_keyword_type:
 
11632
    PyErr_Format(PyExc_TypeError,
 
11633
        "%s() keywords must be strings", function_name);
 
11634
    goto bad;
 
11635
invalid_keyword:
 
11636
    PyErr_Format(PyExc_TypeError,
 
11637
    #if PY_MAJOR_VERSION < 3
 
11638
        "%s() got an unexpected keyword argument '%s'",
 
11639
        function_name, PyString_AsString(key));
 
11640
    #else
 
11641
        "%s() got an unexpected keyword argument '%U'",
 
11642
        function_name, key);
 
11643
    #endif
 
11644
bad:
 
11645
    return -1;
 
11646
}
 
11647
 
 
11648
static INLINE int __Pyx_IsLittleEndian(void) {
 
11649
  unsigned int n = 1;
 
11650
  return *(unsigned char*)(&n) != 0;
 
11651
}
 
11652
 
 
11653
typedef struct {
 
11654
  __Pyx_StructField root;
 
11655
  __Pyx_BufFmt_StackElem* head;
 
11656
  size_t fmt_offset;
 
11657
  int new_count, enc_count;
 
11658
  int is_complex;
 
11659
  char enc_type;
 
11660
  char packmode;
 
11661
} __Pyx_BufFmt_Context;
 
11662
 
 
11663
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
 
11664
                              __Pyx_BufFmt_StackElem* stack,
 
11665
                              __Pyx_TypeInfo* type) {
 
11666
  stack[0].field = &ctx->root;
 
11667
  stack[0].parent_offset = 0;
 
11668
  ctx->root.type = type;
 
11669
  ctx->root.name = "buffer dtype";
 
11670
  ctx->root.offset = 0;
 
11671
  ctx->head = stack;
 
11672
  ctx->head->field = &ctx->root;
 
11673
  ctx->fmt_offset = 0;
 
11674
  ctx->head->parent_offset = 0;
 
11675
  ctx->packmode = '@';
 
11676
  ctx->new_count = 1;
 
11677
  ctx->enc_count = 0;
 
11678
  ctx->enc_type = 0;
 
11679
  ctx->is_complex = 0;
 
11680
  while (type->typegroup == 'S') {
 
11681
    ++ctx->head;
 
11682
    ctx->head->field = type->fields;
 
11683
    ctx->head->parent_offset = 0;
 
11684
    type = type->fields->type;
 
11685
  }
 
11686
}
 
11687
 
 
11688
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
 
11689
    int count;
 
11690
    const char* t = *ts;
 
11691
    if (*t < '0' || *t > '9') {
 
11692
      return -1;
 
11693
    } else {
 
11694
        count = *t++ - '0';
 
11695
        while (*t >= '0' && *t < '9') {
 
11696
            count *= 10;
 
11697
            count += *t++ - '0';
 
11698
        }
 
11699
    }
 
11700
    *ts = t;
 
11701
    return count;
 
11702
}
 
11703
 
 
11704
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
 
11705
  char msg[] = {ch, 0};
 
11706
  PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg);
 
11707
}
 
11708
 
 
11709
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
 
11710
  switch (ch) {
 
11711
    case 'b': return "'char'";
 
11712
    case 'B': return "'unsigned char'";
 
11713
    case 'h': return "'short'";
 
11714
    case 'H': return "'unsigned short'";
 
11715
    case 'i': return "'int'";
 
11716
    case 'I': return "'unsigned int'";
 
11717
    case 'l': return "'long'";
 
11718
    case 'L': return "'unsigned long'";
 
11719
    case 'q': return "'long long'";
 
11720
    case 'Q': return "'unsigned long long'";
 
11721
    case 'f': return (is_complex ? "'complex float'" : "'float'");
 
11722
    case 'd': return (is_complex ? "'complex double'" : "'double'");
 
11723
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
 
11724
    case 'T': return "a struct";
 
11725
    case 'O': return "Python object";
 
11726
    case 'P': return "a pointer";
 
11727
    case 0: return "end";
 
11728
    default: return "unparseable format string";
 
11729
  }
 
11730
}
 
11731
 
 
11732
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
 
11733
  switch (ch) {
 
11734
    case '?': case 'c': case 'b': case 'B': return 1;
 
11735
    case 'h': case 'H': return 2;
 
11736
    case 'i': case 'I': case 'l': case 'L': return 4;
 
11737
    case 'q': case 'Q': return 8;
 
11738
    case 'f': return (is_complex ? 8 : 4);
 
11739
    case 'd': return (is_complex ? 16 : 8);
 
11740
    case 'g': {
 
11741
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
 
11742
      return 0;
 
11743
    }
 
11744
    case 'O': case 'P': return sizeof(void*);
 
11745
    default:
 
11746
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
 
11747
      return 0;
 
11748
    }
 
11749
}
 
11750
 
 
11751
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
 
11752
  switch (ch) {
 
11753
    case 'c': case 'b': case 'B': return 1;
 
11754
    case 'h': case 'H': return sizeof(short);
 
11755
    case 'i': case 'I': return sizeof(int);
 
11756
    case 'l': case 'L': return sizeof(long);
 
11757
    #ifdef HAVE_LONG_LONG
 
11758
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
 
11759
    #endif
 
11760
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
 
11761
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
 
11762
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
 
11763
    case 'O': case 'P': return sizeof(void*);
 
11764
    default: {
 
11765
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
 
11766
      return 0;
 
11767
    }    
 
11768
  }
 
11769
}
 
11770
 
 
11771
typedef struct { char c; short x; } __Pyx_st_short;
 
11772
typedef struct { char c; int x; } __Pyx_st_int;
 
11773
typedef struct { char c; long x; } __Pyx_st_long;
 
11774
typedef struct { char c; float x; } __Pyx_st_float;
 
11775
typedef struct { char c; double x; } __Pyx_st_double;
 
11776
typedef struct { char c; long double x; } __Pyx_st_longdouble;
 
11777
typedef struct { char c; void *x; } __Pyx_st_void_p;
 
11778
#ifdef HAVE_LONG_LONG
 
11779
typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long;
 
11780
#endif
 
11781
 
 
11782
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
 
11783
  switch (ch) {
 
11784
    case '?': case 'c': case 'b': case 'B': return 1;
 
11785
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
 
11786
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
 
11787
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
 
11788
#ifdef HAVE_LONG_LONG
 
11789
    case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG);
 
11790
#endif
 
11791
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
 
11792
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
 
11793
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
 
11794
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
 
11795
    default:
 
11796
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
 
11797
      return 0;
 
11798
    }
 
11799
}
 
11800
 
 
11801
static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
 
11802
  switch (ch) {
 
11803
    case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I';
 
11804
    case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U';
 
11805
    case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R');
 
11806
    case 'O': return 'O';
 
11807
    case 'P': return 'P';
 
11808
    default: {
 
11809
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
 
11810
      return 0;
 
11811
    }    
 
11812
  }
 
11813
}
 
11814
 
 
11815
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
 
11816
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
 
11817
    const char* expected;
 
11818
    const char* quote;
 
11819
    if (ctx->head == NULL) {
 
11820
      expected = "end";
 
11821
      quote = "";
 
11822
    } else {
 
11823
      expected = ctx->head->field->type->name;
 
11824
      quote = "'";
 
11825
    }
 
11826
    PyErr_Format(PyExc_ValueError,
 
11827
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
 
11828
                 quote, expected, quote,
 
11829
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
 
11830
  } else {
 
11831
    __Pyx_StructField* field = ctx->head->field;
 
11832
    __Pyx_StructField* parent = (ctx->head - 1)->field;
 
11833
    PyErr_Format(PyExc_ValueError,
 
11834
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
 
11835
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
 
11836
                 parent->type->name, field->name);
 
11837
  }
 
11838
}
 
11839
 
 
11840
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
 
11841
  char group;
 
11842
  size_t size, offset;
 
11843
  if (ctx->enc_type == 0) return 0;
 
11844
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
 
11845
  do {
 
11846
    __Pyx_StructField* field = ctx->head->field;
 
11847
    __Pyx_TypeInfo* type = field->type;
 
11848
  
 
11849
    if (ctx->packmode == '@' || ctx->packmode == '^') {
 
11850
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
 
11851
    } else {
 
11852
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
 
11853
    }
 
11854
    if (ctx->packmode == '@') {
 
11855
      int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
 
11856
      int align_mod_offset;
 
11857
      if (align_at == 0) return -1;
 
11858
      align_mod_offset = ctx->fmt_offset % align_at;
 
11859
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
 
11860
    }
 
11861
 
 
11862
    if (type->size != size || type->typegroup != group) {
 
11863
      if (type->typegroup == 'C' && type->fields != NULL) {
 
11864
        /* special case -- treat as struct rather than complex number */
 
11865
        size_t parent_offset = ctx->head->parent_offset + field->offset;
 
11866
        ++ctx->head;
 
11867
        ctx->head->field = type->fields;
 
11868
        ctx->head->parent_offset = parent_offset;
 
11869
        continue;
 
11870
      }
 
11871
    
 
11872
      __Pyx_BufFmt_RaiseExpected(ctx);
 
11873
      return -1;
 
11874
    }
 
11875
 
 
11876
    offset = ctx->head->parent_offset + field->offset;
 
11877
    if (ctx->fmt_offset != offset) {
 
11878
      PyErr_Format(PyExc_ValueError,
 
11879
                   "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d "
 
11880
                   "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset);
 
11881
      return -1;
 
11882
    }
 
11883
 
 
11884
    ctx->fmt_offset += size;
 
11885
  
 
11886
    --ctx->enc_count; /* Consume from buffer string */
 
11887
 
 
11888
    /* Done checking, move to next field, pushing or popping struct stack if needed */
 
11889
    while (1) {
 
11890
      if (field == &ctx->root) {
 
11891
        ctx->head = NULL;
 
11892
        if (ctx->enc_count != 0) {
 
11893
          __Pyx_BufFmt_RaiseExpected(ctx);
 
11894
          return -1;
 
11895
        }
 
11896
        break; /* breaks both loops as ctx->enc_count == 0 */
 
11897
      }
 
11898
      ctx->head->field = ++field;
 
11899
      if (field->type == NULL) {
 
11900
        --ctx->head;
 
11901
        field = ctx->head->field;
 
11902
        continue;
 
11903
      } else if (field->type->typegroup == 'S') {
 
11904
        size_t parent_offset = ctx->head->parent_offset + field->offset;
 
11905
        if (field->type->fields->type == NULL) continue; /* empty struct */
 
11906
        field = field->type->fields;
 
11907
        ++ctx->head;
 
11908
        ctx->head->field = field;
 
11909
        ctx->head->parent_offset = parent_offset;
 
11910
        break;
 
11911
      } else {
 
11912
        break;
 
11913
      }
 
11914
    }
 
11915
  } while (ctx->enc_count);
 
11916
  ctx->enc_type = 0;
 
11917
  ctx->is_complex = 0;
 
11918
  return 0;    
 
11919
}
 
11920
 
 
11921
static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) {
 
11922
  if (ctx->enc_type != 0 || ctx->packmode != '@') {
 
11923
    PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)");
 
11924
    return -1;
 
11925
  }
 
11926
  return 0;
 
11927
}
 
11928
 
 
11929
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
 
11930
  int got_Z = 0;
 
11931
  while (1) {
 
11932
    switch(*ts) {
 
11933
      case 0:
 
11934
        if (ctx->enc_type != 0 && ctx->head == NULL) {
 
11935
          __Pyx_BufFmt_RaiseExpected(ctx);
 
11936
          return NULL;
 
11937
        }
 
11938
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
 
11939
        if (ctx->head != NULL) {
 
11940
          __Pyx_BufFmt_RaiseExpected(ctx);
 
11941
          return NULL;
 
11942
        }
 
11943
        return ts;
 
11944
      case ' ':
 
11945
      case 10:
 
11946
      case 13:
 
11947
        ++ts;
 
11948
        break;
 
11949
      case '<':
 
11950
        if (!__Pyx_IsLittleEndian()) {
 
11951
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
 
11952
          return NULL;
 
11953
        }
 
11954
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
 
11955
        ctx->packmode = '=';
 
11956
        ++ts;
 
11957
        break;
 
11958
      case '>':
 
11959
      case '!':
 
11960
        if (__Pyx_IsLittleEndian()) {
 
11961
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
 
11962
          return NULL;
 
11963
        }
 
11964
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
 
11965
        ctx->packmode = '=';
 
11966
        ++ts;
 
11967
        break;
 
11968
      case '=':
 
11969
      case '@':
 
11970
      case '^':
 
11971
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
 
11972
        ctx->packmode = *ts++;
 
11973
        break;
 
11974
      case 'T': /* substruct */
 
11975
        {
 
11976
          int i;
 
11977
          const char* ts_after_sub;
 
11978
          int struct_count = ctx->new_count;
 
11979
          ctx->new_count = 1;
 
11980
          ++ts;
 
11981
          if (*ts != '{') {
 
11982
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
 
11983
            return NULL;
 
11984
          }
 
11985
          ++ts;
 
11986
          ts_after_sub = ts;
 
11987
          for (i = 0; i != struct_count; ++i) {
 
11988
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
 
11989
            if (!ts_after_sub) return NULL;
 
11990
          }
 
11991
          ts = ts_after_sub;
 
11992
        }
 
11993
        break;
 
11994
      case '}': /* end of substruct; either repeat or move on */
 
11995
        ++ts;
 
11996
        return ts;
 
11997
      case 'x':
 
11998
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
 
11999
        ctx->fmt_offset += ctx->new_count;
 
12000
        ctx->new_count = 1;
 
12001
        ctx->enc_count = 0;
 
12002
        ctx->enc_type = 0;
 
12003
        ++ts;
 
12004
        break;
 
12005
      case 'Z':
 
12006
        got_Z = 1;
 
12007
        ++ts;
 
12008
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
 
12009
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
 
12010
          return NULL;
 
12011
        }        /* fall through */
 
12012
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
 
12013
      case 'l': case 'L': case 'q': case 'Q':
 
12014
      case 'f': case 'd': case 'g':
 
12015
      case 'O':
 
12016
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex) {
 
12017
          /* Continue pooling same type */
 
12018
          ctx->enc_count += ctx->new_count;
 
12019
        } else {
 
12020
          /* New type */
 
12021
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
 
12022
          ctx->enc_count = ctx->new_count;
 
12023
          ctx->enc_type = *ts;
 
12024
          ctx->is_complex = got_Z;
 
12025
        }
 
12026
        ++ts;
 
12027
        ctx->new_count = 1;
 
12028
        got_Z = 0;
 
12029
        break;
 
12030
      default:
 
12031
        {
 
12032
          ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts);
 
12033
          if (ctx->new_count == -1) { /* First char was not a digit */
 
12034
            char msg[2] = { *ts, 0 };
 
12035
            PyErr_Format(PyExc_ValueError,
 
12036
                         "Does not understand character buffer dtype format string ('%s')", msg);
 
12037
            return NULL;
 
12038
          }
 
12039
        }
 
12040
      
 
12041
    }
 
12042
  }
 
12043
}
 
12044
 
 
12045
static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
 
12046
  buf->buf = NULL;
 
12047
  buf->obj = NULL;
 
12048
  buf->strides = __Pyx_zeros;
 
12049
  buf->shape = __Pyx_zeros;
 
12050
  buf->suboffsets = __Pyx_minusones;
 
12051
}
 
12052
 
 
12053
static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) {
 
12054
  if (obj == Py_None) {
 
12055
    __Pyx_ZeroBuffer(buf);
 
12056
    return 0;
 
12057
  }
 
12058
  buf->buf = NULL;
 
12059
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
 
12060
  if (buf->ndim != nd) {
 
12061
    PyErr_Format(PyExc_ValueError,
 
12062
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
 
12063
                 nd, buf->ndim);
 
12064
    goto fail;
 
12065
  }
 
12066
  if (!cast) {
 
12067
    __Pyx_BufFmt_Context ctx;
 
12068
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
 
12069
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
 
12070
  }
 
12071
  if ((unsigned)buf->itemsize != dtype->size) {
 
12072
    PyErr_Format(PyExc_ValueError,
 
12073
      "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
 
12074
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
 
12075
      dtype->name,
 
12076
      dtype->size, (dtype->size > 1) ? "s" : "");
 
12077
    goto fail;
 
12078
  }
 
12079
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
 
12080
  return 0;
 
12081
fail:;
 
12082
  __Pyx_ZeroBuffer(buf);
 
12083
  return -1;
 
12084
}
 
12085
 
 
12086
static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
 
12087
  if (info->buf == NULL) return;
 
12088
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
 
12089
  __Pyx_ReleaseBuffer(info);
 
12090
}
 
12091
 
 
12092
static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
 
12093
    PyObject *tmp_type, *tmp_value, *tmp_tb;
 
12094
    PyThreadState *tstate = PyThreadState_GET();
 
12095
 
 
12096
#if PY_MAJOR_VERSION >= 3
 
12097
    /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */
 
12098
    if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) {
 
12099
        tmp_type = tstate->exc_type;
 
12100
        tmp_value = tstate->exc_value;
 
12101
        tmp_tb = tstate->exc_traceback;
 
12102
        PyErr_NormalizeException(&type, &value, &tb);
 
12103
        PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb);
 
12104
        tstate->exc_type = 0;
 
12105
        tstate->exc_value = 0;
 
12106
        tstate->exc_traceback = 0;
 
12107
        PyException_SetContext(value, tmp_value);
 
12108
        Py_DECREF(tmp_type);
 
12109
        Py_XDECREF(tmp_tb);
 
12110
    }
 
12111
#endif
 
12112
 
 
12113
    tmp_type = tstate->curexc_type;
 
12114
    tmp_value = tstate->curexc_value;
 
12115
    tmp_tb = tstate->curexc_traceback;
 
12116
    tstate->curexc_type = type;
 
12117
    tstate->curexc_value = value;
 
12118
    tstate->curexc_traceback = tb;
 
12119
    Py_XDECREF(tmp_type);
 
12120
    Py_XDECREF(tmp_value);
 
12121
    Py_XDECREF(tmp_tb);
 
12122
}
 
12123
 
 
12124
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
 
12125
    PyThreadState *tstate = PyThreadState_GET();
 
12126
    *type = tstate->curexc_type;
 
12127
    *value = tstate->curexc_value;
 
12128
    *tb = tstate->curexc_traceback;
 
12129
 
 
12130
    tstate->curexc_type = 0;
 
12131
    tstate->curexc_value = 0;
 
12132
    tstate->curexc_traceback = 0;
 
12133
}
 
12134
 
 
12135
 
 
12136
static INLINE void __Pyx_RaiseNoneNotIterableError(void) {
 
12137
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is iterable");
 
12138
}
 
12139
 
 
12140
static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
 
12141
    PyErr_Format(PyExc_ValueError,
 
12142
        #if PY_VERSION_HEX < 0x02050000
 
12143
                 "need more than %d value%s to unpack", (int)index,
 
12144
        #else
 
12145
                 "need more than %zd value%s to unpack", index,
 
12146
        #endif
 
12147
                 (index == 1) ? "" : "s");
 
12148
}
 
12149
 
 
12150
static INLINE void __Pyx_RaiseTooManyValuesError(void) {
 
12151
    PyErr_SetString(PyExc_ValueError, "too many values to unpack");
 
12152
}
 
12153
 
 
12154
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
 
12155
    if (t == Py_None) {
 
12156
      __Pyx_RaiseNoneNotIterableError();
 
12157
    } else if (PyTuple_GET_SIZE(t) < index) {
 
12158
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
 
12159
    } else {
 
12160
      __Pyx_RaiseTooManyValuesError();
 
12161
    }
 
12162
}
 
12163
 
 
12164
static void __Pyx_RaiseBufferFallbackError(void) {
 
12165
  PyErr_Format(PyExc_ValueError,
 
12166
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
 
12167
}
 
12168
 
 
12169
static void __Pyx_RaiseBufferIndexError(int axis) {
 
12170
  PyErr_Format(PyExc_IndexError,
 
12171
     "Out of bounds on buffer access (axis %d)", axis);
 
12172
}
 
12173
 
 
12174
 
 
12175
 
 
12176
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
 
12177
    const char *name, int exact)
 
12178
{
 
12179
    if (!type) {
 
12180
        PyErr_Format(PyExc_SystemError, "Missing type object");
 
12181
        return 0;
 
12182
    }
 
12183
    if (none_allowed && obj == Py_None) return 1;
 
12184
    else if (exact) {
 
12185
        if (Py_TYPE(obj) == type) return 1;
 
12186
    }
 
12187
    else {
 
12188
        if (PyObject_TypeCheck(obj, type)) return 1;
 
12189
    }
 
12190
    PyErr_Format(PyExc_TypeError,
 
12191
        "Argument '%s' has incorrect type (expected %s, got %s)",
 
12192
        name, type->tp_name, Py_TYPE(obj)->tp_name);
 
12193
    return 0;
 
12194
}
 
12195
 
 
12196
static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
 
12197
    PyThreadState *tstate = PyThreadState_GET();
 
12198
    *type = tstate->exc_type;
 
12199
    *value = tstate->exc_value;
 
12200
    *tb = tstate->exc_traceback;
 
12201
    Py_XINCREF(*type);
 
12202
    Py_XINCREF(*value);
 
12203
    Py_XINCREF(*tb);
 
12204
}
 
12205
 
 
12206
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
 
12207
    PyObject *tmp_type, *tmp_value, *tmp_tb;
 
12208
    PyThreadState *tstate = PyThreadState_GET();
 
12209
    tmp_type = tstate->exc_type;
 
12210
    tmp_value = tstate->exc_value;
 
12211
    tmp_tb = tstate->exc_traceback;
 
12212
    tstate->exc_type = type;
 
12213
    tstate->exc_value = value;
 
12214
    tstate->exc_traceback = tb;
 
12215
    Py_XDECREF(tmp_type);
 
12216
    Py_XDECREF(tmp_value);
 
12217
    Py_XDECREF(tmp_tb);
 
12218
}
 
12219
 
 
12220
#if PY_MAJOR_VERSION < 3
 
12221
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
 
12222
  #if PY_VERSION_HEX >= 0x02060000
 
12223
  if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER)
 
12224
      return PyObject_GetBuffer(obj, view, flags);
 
12225
  #endif
 
12226
  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
 
12227
  else {
 
12228
  PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
 
12229
  return -1;
 
12230
    }
 
12231
}
 
12232
 
 
12233
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
 
12234
  PyObject* obj = view->obj;
 
12235
  if (obj) {
 
12236
if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view);
 
12237
    Py_DECREF(obj);
 
12238
    view->obj = NULL;
 
12239
  }
 
12240
}
 
12241
 
 
12242
#endif
 
12243
 
 
12244
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
 
12245
    PyObject *__import__ = 0;
 
12246
    PyObject *empty_list = 0;
 
12247
    PyObject *module = 0;
 
12248
    PyObject *global_dict = 0;
 
12249
    PyObject *empty_dict = 0;
 
12250
    PyObject *list;
 
12251
    __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
 
12252
    if (!__import__)
 
12253
        goto bad;
 
12254
    if (from_list)
 
12255
        list = from_list;
 
12256
    else {
 
12257
        empty_list = PyList_New(0);
 
12258
        if (!empty_list)
 
12259
            goto bad;
 
12260
        list = empty_list;
 
12261
    }
 
12262
    global_dict = PyModule_GetDict(__pyx_m);
 
12263
    if (!global_dict)
 
12264
        goto bad;
 
12265
    empty_dict = PyDict_New();
 
12266
    if (!empty_dict)
 
12267
        goto bad;
 
12268
    module = PyObject_CallFunctionObjArgs(__import__,
 
12269
        name, global_dict, empty_dict, list, NULL);
 
12270
bad:
 
12271
    Py_XDECREF(empty_list);
 
12272
    Py_XDECREF(__import__);
 
12273
    Py_XDECREF(empty_dict);
 
12274
    return module;
 
12275
}
 
12276
 
 
12277
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
 
12278
    PyObject *result;
 
12279
    result = PyObject_GetAttr(dict, name);
 
12280
    if (!result)
 
12281
        PyErr_SetObject(PyExc_NameError, name);
 
12282
    return result;
 
12283
}
 
12284
 
 
12285
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
 
12286
    Py_XINCREF(type);
 
12287
    Py_XINCREF(value);
 
12288
    Py_XINCREF(tb);
 
12289
    /* First, check the traceback argument, replacing None with NULL. */
 
12290
    if (tb == Py_None) {
 
12291
        Py_DECREF(tb);
 
12292
        tb = 0;
 
12293
    }
 
12294
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
 
12295
        PyErr_SetString(PyExc_TypeError,
 
12296
            "raise: arg 3 must be a traceback or None");
 
12297
        goto raise_error;
 
12298
    }
 
12299
    /* Next, replace a missing value with None */
 
12300
    if (value == NULL) {
 
12301
        value = Py_None;
 
12302
        Py_INCREF(value);
 
12303
    }
 
12304
    #if PY_VERSION_HEX < 0x02050000
 
12305
    if (!PyClass_Check(type))
 
12306
    #else
 
12307
    if (!PyType_Check(type))
 
12308
    #endif
 
12309
    {
 
12310
        /* Raising an instance.  The value should be a dummy. */
 
12311
        if (value != Py_None) {
 
12312
            PyErr_SetString(PyExc_TypeError,
 
12313
                "instance exception may not have a separate value");
 
12314
            goto raise_error;
 
12315
        }
 
12316
        /* Normalize to raise <class>, <instance> */
 
12317
        Py_DECREF(value);
 
12318
        value = type;
 
12319
        #if PY_VERSION_HEX < 0x02050000
 
12320
            if (PyInstance_Check(type)) {
 
12321
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
 
12322
                Py_INCREF(type);
 
12323
            }
 
12324
            else {
 
12325
                type = 0;
 
12326
                PyErr_SetString(PyExc_TypeError,
 
12327
                    "raise: exception must be an old-style class or instance");
 
12328
                goto raise_error;
 
12329
            }
 
12330
        #else
 
12331
            type = (PyObject*) Py_TYPE(type);
 
12332
            Py_INCREF(type);
 
12333
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
 
12334
                PyErr_SetString(PyExc_TypeError,
 
12335
                    "raise: exception class must be a subclass of BaseException");
 
12336
                goto raise_error;
 
12337
            }
 
12338
        #endif
 
12339
    }
 
12340
    __Pyx_ErrRestore(type, value, tb);
 
12341
    return;
 
12342
raise_error:
 
12343
    Py_XDECREF(value);
 
12344
    Py_XDECREF(type);
 
12345
    Py_XDECREF(tb);
 
12346
    return;
 
12347
}
 
12348
 
 
12349
static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
 
12350
    PyObject *item;
 
12351
    if (!(item = PyIter_Next(iter))) {
 
12352
        if (!PyErr_Occurred()) {
 
12353
            __Pyx_RaiseNeedMoreValuesError(index);
 
12354
        }
 
12355
    }
 
12356
    return item;
 
12357
}
 
12358
 
 
12359
static int __Pyx_EndUnpack(PyObject *iter) {
 
12360
    PyObject *item;
 
12361
    if ((item = PyIter_Next(iter))) {
 
12362
        Py_DECREF(item);
 
12363
        __Pyx_RaiseTooManyValuesError();
 
12364
        return -1;
 
12365
    }
 
12366
    else if (!PyErr_Occurred())
 
12367
        return 0;
 
12368
    else
 
12369
        return -1;
 
12370
}
 
12371
 
 
12372
static INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
 
12373
     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
 
12374
     return *s1 == *s2;
 
12375
}
 
12376
 
 
12377
static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
 
12378
    if (sizeof(unsigned char) < sizeof(long)) {
 
12379
        long val = __Pyx_PyInt_AsLong(x);
 
12380
        if (unlikely(val != (long)(unsigned char)val)) {
 
12381
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12382
                return (unsigned char)-1;
 
12383
            if (unlikely(val < 0)) {
 
12384
                PyErr_SetString(PyExc_OverflowError,
 
12385
                                "can't convert negative value to unsigned char");
 
12386
                return (unsigned char)-1;
 
12387
            }
 
12388
            PyErr_SetString(PyExc_OverflowError,
 
12389
                           "value too large to convert to unsigned char");
 
12390
            return (unsigned char)-1;
 
12391
        }
 
12392
        return (unsigned char)val;
 
12393
    }
 
12394
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
 
12395
}
 
12396
 
 
12397
static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
 
12398
    if (sizeof(unsigned short) < sizeof(long)) {
 
12399
        long val = __Pyx_PyInt_AsLong(x);
 
12400
        if (unlikely(val != (long)(unsigned short)val)) {
 
12401
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12402
                return (unsigned short)-1;
 
12403
            if (unlikely(val < 0)) {
 
12404
                PyErr_SetString(PyExc_OverflowError,
 
12405
                                "can't convert negative value to unsigned short");
 
12406
                return (unsigned short)-1;
 
12407
            }
 
12408
            PyErr_SetString(PyExc_OverflowError,
 
12409
                           "value too large to convert to unsigned short");
 
12410
            return (unsigned short)-1;
 
12411
        }
 
12412
        return (unsigned short)val;
 
12413
    }
 
12414
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
 
12415
}
 
12416
 
 
12417
static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
 
12418
    if (sizeof(unsigned int) < sizeof(long)) {
 
12419
        long val = __Pyx_PyInt_AsLong(x);
 
12420
        if (unlikely(val != (long)(unsigned int)val)) {
 
12421
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12422
                return (unsigned int)-1;
 
12423
            if (unlikely(val < 0)) {
 
12424
                PyErr_SetString(PyExc_OverflowError,
 
12425
                                "can't convert negative value to unsigned int");
 
12426
                return (unsigned int)-1;
 
12427
            }
 
12428
            PyErr_SetString(PyExc_OverflowError,
 
12429
                           "value too large to convert to unsigned int");
 
12430
            return (unsigned int)-1;
 
12431
        }
 
12432
        return (unsigned int)val;
 
12433
    }
 
12434
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
 
12435
}
 
12436
 
 
12437
static INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
 
12438
    if (sizeof(char) < sizeof(long)) {
 
12439
        long val = __Pyx_PyInt_AsLong(x);
 
12440
        if (unlikely(val != (long)(char)val)) {
 
12441
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12442
                return (char)-1;
 
12443
            PyErr_SetString(PyExc_OverflowError,
 
12444
                           "value too large to convert to char");
 
12445
            return (char)-1;
 
12446
        }
 
12447
        return (char)val;
 
12448
    }
 
12449
    return (char)__Pyx_PyInt_AsLong(x);
 
12450
}
 
12451
 
 
12452
static INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
 
12453
    if (sizeof(short) < sizeof(long)) {
 
12454
        long val = __Pyx_PyInt_AsLong(x);
 
12455
        if (unlikely(val != (long)(short)val)) {
 
12456
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12457
                return (short)-1;
 
12458
            PyErr_SetString(PyExc_OverflowError,
 
12459
                           "value too large to convert to short");
 
12460
            return (short)-1;
 
12461
        }
 
12462
        return (short)val;
 
12463
    }
 
12464
    return (short)__Pyx_PyInt_AsLong(x);
 
12465
}
 
12466
 
 
12467
static INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
 
12468
    if (sizeof(int) < sizeof(long)) {
 
12469
        long val = __Pyx_PyInt_AsLong(x);
 
12470
        if (unlikely(val != (long)(int)val)) {
 
12471
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12472
                return (int)-1;
 
12473
            PyErr_SetString(PyExc_OverflowError,
 
12474
                           "value too large to convert to int");
 
12475
            return (int)-1;
 
12476
        }
 
12477
        return (int)val;
 
12478
    }
 
12479
    return (int)__Pyx_PyInt_AsLong(x);
 
12480
}
 
12481
 
 
12482
static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
 
12483
    if (sizeof(signed char) < sizeof(long)) {
 
12484
        long val = __Pyx_PyInt_AsLong(x);
 
12485
        if (unlikely(val != (long)(signed char)val)) {
 
12486
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12487
                return (signed char)-1;
 
12488
            PyErr_SetString(PyExc_OverflowError,
 
12489
                           "value too large to convert to signed char");
 
12490
            return (signed char)-1;
 
12491
        }
 
12492
        return (signed char)val;
 
12493
    }
 
12494
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
 
12495
}
 
12496
 
 
12497
static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
 
12498
    if (sizeof(signed short) < sizeof(long)) {
 
12499
        long val = __Pyx_PyInt_AsLong(x);
 
12500
        if (unlikely(val != (long)(signed short)val)) {
 
12501
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12502
                return (signed short)-1;
 
12503
            PyErr_SetString(PyExc_OverflowError,
 
12504
                           "value too large to convert to signed short");
 
12505
            return (signed short)-1;
 
12506
        }
 
12507
        return (signed short)val;
 
12508
    }
 
12509
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
 
12510
}
 
12511
 
 
12512
static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
 
12513
    if (sizeof(signed int) < sizeof(long)) {
 
12514
        long val = __Pyx_PyInt_AsLong(x);
 
12515
        if (unlikely(val != (long)(signed int)val)) {
 
12516
            if (unlikely(val == -1 && PyErr_Occurred()))
 
12517
                return (signed int)-1;
 
12518
            PyErr_SetString(PyExc_OverflowError,
 
12519
                           "value too large to convert to signed int");
 
12520
            return (signed int)-1;
 
12521
        }
 
12522
        return (signed int)val;
 
12523
    }
 
12524
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
 
12525
}
 
12526
 
 
12527
static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 
12528
#if PY_VERSION_HEX < 0x03000000
 
12529
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
 
12530
        long val = PyInt_AS_LONG(x);
 
12531
        if (unlikely(val < 0)) {
 
12532
            PyErr_SetString(PyExc_OverflowError,
 
12533
                            "can't convert negative value to unsigned long");
 
12534
            return (unsigned long)-1;
 
12535
        }
 
12536
        return (unsigned long)val;
 
12537
    } else
 
12538
#endif
 
12539
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
 
12540
        if (unlikely(Py_SIZE(x) < 0)) {
 
12541
            PyErr_SetString(PyExc_OverflowError,
 
12542
                            "can't convert negative value to unsigned long");
 
12543
            return (unsigned long)-1;
 
12544
        }
 
12545
        return PyLong_AsUnsignedLong(x);
 
12546
    } else {
 
12547
        unsigned long val;
 
12548
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
12549
        if (!tmp) return (unsigned long)-1;
 
12550
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
 
12551
        Py_DECREF(tmp);
 
12552
        return val;
 
12553
    }
 
12554
}
 
12555
 
 
12556
static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
 
12557
#if PY_VERSION_HEX < 0x03000000
 
12558
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
 
12559
        long val = PyInt_AS_LONG(x);
 
12560
        if (unlikely(val < 0)) {
 
12561
            PyErr_SetString(PyExc_OverflowError,
 
12562
                            "can't convert negative value to unsigned PY_LONG_LONG");
 
12563
            return (unsigned PY_LONG_LONG)-1;
 
12564
        }
 
12565
        return (unsigned PY_LONG_LONG)val;
 
12566
    } else
 
12567
#endif
 
12568
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
 
12569
        if (unlikely(Py_SIZE(x) < 0)) {
 
12570
            PyErr_SetString(PyExc_OverflowError,
 
12571
                            "can't convert negative value to unsigned PY_LONG_LONG");
 
12572
            return (unsigned PY_LONG_LONG)-1;
 
12573
        }
 
12574
        return PyLong_AsUnsignedLongLong(x);
 
12575
    } else {
 
12576
        unsigned PY_LONG_LONG val;
 
12577
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
12578
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
 
12579
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
 
12580
        Py_DECREF(tmp);
 
12581
        return val;
 
12582
    }
 
12583
}
 
12584
 
 
12585
static INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 
12586
#if PY_VERSION_HEX < 0x03000000
 
12587
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
 
12588
        long val = PyInt_AS_LONG(x);
 
12589
        return (long)val;
 
12590
    } else
 
12591
#endif
 
12592
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
 
12593
        return PyLong_AsLong(x);
 
12594
    } else {
 
12595
        long val;
 
12596
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
12597
        if (!tmp) return (long)-1;
 
12598
        val = __Pyx_PyInt_AsLong(tmp);
 
12599
        Py_DECREF(tmp);
 
12600
        return val;
 
12601
    }
 
12602
}
 
12603
 
 
12604
static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 
12605
#if PY_VERSION_HEX < 0x03000000
 
12606
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
 
12607
        long val = PyInt_AS_LONG(x);
 
12608
        return (PY_LONG_LONG)val;
 
12609
    } else
 
12610
#endif
 
12611
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
 
12612
        return PyLong_AsLongLong(x);
 
12613
    } else {
 
12614
        PY_LONG_LONG val;
 
12615
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
12616
        if (!tmp) return (PY_LONG_LONG)-1;
 
12617
        val = __Pyx_PyInt_AsLongLong(tmp);
 
12618
        Py_DECREF(tmp);
 
12619
        return val;
 
12620
    }
 
12621
}
 
12622
 
 
12623
static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 
12624
#if PY_VERSION_HEX < 0x03000000
 
12625
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
 
12626
        long val = PyInt_AS_LONG(x);
 
12627
        return (signed long)val;
 
12628
    } else
 
12629
#endif
 
12630
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
 
12631
        return PyLong_AsLong(x);
 
12632
    } else {
 
12633
        signed long val;
 
12634
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
12635
        if (!tmp) return (signed long)-1;
 
12636
        val = __Pyx_PyInt_AsSignedLong(tmp);
 
12637
        Py_DECREF(tmp);
 
12638
        return val;
 
12639
    }
 
12640
}
 
12641
 
 
12642
static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
 
12643
#if PY_VERSION_HEX < 0x03000000
 
12644
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
 
12645
        long val = PyInt_AS_LONG(x);
 
12646
        return (signed PY_LONG_LONG)val;
 
12647
    } else
 
12648
#endif
 
12649
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
 
12650
        return PyLong_AsLongLong(x);
 
12651
    } else {
 
12652
        signed PY_LONG_LONG val;
 
12653
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
12654
        if (!tmp) return (signed PY_LONG_LONG)-1;
 
12655
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
 
12656
        Py_DECREF(tmp);
 
12657
        return val;
 
12658
    }
 
12659
}
 
12660
 
 
12661
#ifndef __PYX_HAVE_RT_ImportType
 
12662
#define __PYX_HAVE_RT_ImportType
 
12663
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
 
12664
    long size)
 
12665
{
 
12666
    PyObject *py_module = 0;
 
12667
    PyObject *result = 0;
 
12668
    PyObject *py_name = 0;
 
12669
 
 
12670
    py_module = __Pyx_ImportModule(module_name);
 
12671
    if (!py_module)
 
12672
        goto bad;
 
12673
    #if PY_MAJOR_VERSION < 3
 
12674
    py_name = PyString_FromString(class_name);
 
12675
    #else
 
12676
    py_name = PyUnicode_FromString(class_name);
 
12677
    #endif
 
12678
    if (!py_name)
 
12679
        goto bad;
 
12680
    result = PyObject_GetAttr(py_module, py_name);
 
12681
    Py_DECREF(py_name);
 
12682
    py_name = 0;
 
12683
    Py_DECREF(py_module);
 
12684
    py_module = 0;
 
12685
    if (!result)
 
12686
        goto bad;
 
12687
    if (!PyType_Check(result)) {
 
12688
        PyErr_Format(PyExc_TypeError, 
 
12689
            "%s.%s is not a type object",
 
12690
            module_name, class_name);
 
12691
        goto bad;
 
12692
    }
 
12693
    if (((PyTypeObject *)result)->tp_basicsize != size) {
 
12694
        PyErr_Format(PyExc_ValueError, 
 
12695
            "%s.%s does not appear to be the correct type object",
 
12696
            module_name, class_name);
 
12697
        goto bad;
 
12698
    }
 
12699
    return (PyTypeObject *)result;
 
12700
bad:
 
12701
    Py_XDECREF(py_module);
 
12702
    Py_XDECREF(result);
 
12703
    return 0;
 
12704
}
 
12705
#endif
 
12706
 
 
12707
#ifndef __PYX_HAVE_RT_ImportModule
 
12708
#define __PYX_HAVE_RT_ImportModule
 
12709
static PyObject *__Pyx_ImportModule(const char *name) {
 
12710
    PyObject *py_name = 0;
 
12711
    PyObject *py_module = 0;
 
12712
 
 
12713
    #if PY_MAJOR_VERSION < 3
 
12714
    py_name = PyString_FromString(name);
 
12715
    #else
 
12716
    py_name = PyUnicode_FromString(name);
 
12717
    #endif
 
12718
    if (!py_name)
 
12719
        goto bad;
 
12720
    py_module = PyImport_Import(py_name);
 
12721
    Py_DECREF(py_name);
 
12722
    return py_module;
 
12723
bad:
 
12724
    Py_XDECREF(py_name);
 
12725
    return 0;
 
12726
}
 
12727
#endif
 
12728
 
 
12729
#include "compile.h"
 
12730
#include "frameobject.h"
 
12731
#include "traceback.h"
 
12732
 
 
12733
static void __Pyx_AddTraceback(const char *funcname) {
 
12734
    PyObject *py_srcfile = 0;
 
12735
    PyObject *py_funcname = 0;
 
12736
    PyObject *py_globals = 0;
 
12737
    PyObject *empty_string = 0;
 
12738
    PyCodeObject *py_code = 0;
 
12739
    PyFrameObject *py_frame = 0;
 
12740
 
 
12741
    #if PY_MAJOR_VERSION < 3
 
12742
    py_srcfile = PyString_FromString(__pyx_filename);
 
12743
    #else
 
12744
    py_srcfile = PyUnicode_FromString(__pyx_filename);
 
12745
    #endif
 
12746
    if (!py_srcfile) goto bad;
 
12747
    if (__pyx_clineno) {
 
12748
        #if PY_MAJOR_VERSION < 3
 
12749
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
 
12750
        #else
 
12751
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
 
12752
        #endif
 
12753
    }
 
12754
    else {
 
12755
        #if PY_MAJOR_VERSION < 3
 
12756
        py_funcname = PyString_FromString(funcname);
 
12757
        #else
 
12758
        py_funcname = PyUnicode_FromString(funcname);
 
12759
        #endif
 
12760
    }
 
12761
    if (!py_funcname) goto bad;
 
12762
    py_globals = PyModule_GetDict(__pyx_m);
 
12763
    if (!py_globals) goto bad;
 
12764
    #if PY_MAJOR_VERSION < 3
 
12765
    empty_string = PyString_FromStringAndSize("", 0);
 
12766
    #else
 
12767
    empty_string = PyBytes_FromStringAndSize("", 0);
 
12768
    #endif
 
12769
    if (!empty_string) goto bad;
 
12770
    py_code = PyCode_New(
 
12771
        0,            /*int argcount,*/
 
12772
        #if PY_MAJOR_VERSION >= 3
 
12773
        0,            /*int kwonlyargcount,*/
 
12774
        #endif
 
12775
        0,            /*int nlocals,*/
 
12776
        0,            /*int stacksize,*/
 
12777
        0,            /*int flags,*/
 
12778
        empty_string, /*PyObject *code,*/
 
12779
        __pyx_empty_tuple,  /*PyObject *consts,*/
 
12780
        __pyx_empty_tuple,  /*PyObject *names,*/
 
12781
        __pyx_empty_tuple,  /*PyObject *varnames,*/
 
12782
        __pyx_empty_tuple,  /*PyObject *freevars,*/
 
12783
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
 
12784
        py_srcfile,   /*PyObject *filename,*/
 
12785
        py_funcname,  /*PyObject *name,*/
 
12786
        __pyx_lineno,   /*int firstlineno,*/
 
12787
        empty_string  /*PyObject *lnotab*/
 
12788
    );
 
12789
    if (!py_code) goto bad;
 
12790
    py_frame = PyFrame_New(
 
12791
        PyThreadState_GET(), /*PyThreadState *tstate,*/
 
12792
        py_code,             /*PyCodeObject *code,*/
 
12793
        py_globals,          /*PyObject *globals,*/
 
12794
        0                    /*PyObject *locals*/
 
12795
    );
 
12796
    if (!py_frame) goto bad;
 
12797
    py_frame->f_lineno = __pyx_lineno;
 
12798
    PyTraceBack_Here(py_frame);
 
12799
bad:
 
12800
    Py_XDECREF(py_srcfile);
 
12801
    Py_XDECREF(py_funcname);
 
12802
    Py_XDECREF(empty_string);
 
12803
    Py_XDECREF(py_code);
 
12804
    Py_XDECREF(py_frame);
 
12805
}
 
12806
 
 
12807
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
 
12808
    while (t->p) {
 
12809
        #if PY_MAJOR_VERSION < 3
 
12810
        if (t->is_unicode && (!t->is_identifier)) {
 
12811
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
 
12812
        } else if (t->intern) {
 
12813
            *t->p = PyString_InternFromString(t->s);
 
12814
        } else {
 
12815
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
 
12816
        }
 
12817
        #else  /* Python 3+ has unicode identifiers */
 
12818
        if (t->is_identifier || (t->is_unicode && t->intern)) {
 
12819
            *t->p = PyUnicode_InternFromString(t->s);
 
12820
        } else if (t->is_unicode) {
 
12821
            *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
 
12822
        } else {
 
12823
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
 
12824
        }
 
12825
        #endif
 
12826
        if (!*t->p)
 
12827
            return -1;
 
12828
        ++t;
 
12829
    }
 
12830
    return 0;
 
12831
}
 
12832
 
 
12833
/* Type Conversion Functions */
 
12834
 
 
12835
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
 
12836
   if (x == Py_True) return 1;
 
12837
   else if ((x == Py_False) | (x == Py_None)) return 0;
 
12838
   else return PyObject_IsTrue(x);
 
12839
}
 
12840
 
 
12841
static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
 
12842
  PyNumberMethods *m;
 
12843
  const char *name = NULL;
 
12844
  PyObject *res = NULL;
 
12845
#if PY_VERSION_HEX < 0x03000000
 
12846
  if (PyInt_Check(x) || PyLong_Check(x))
 
12847
#else
 
12848
  if (PyLong_Check(x))
 
12849
#endif
 
12850
    return Py_INCREF(x), x;
 
12851
  m = Py_TYPE(x)->tp_as_number;
 
12852
#if PY_VERSION_HEX < 0x03000000
 
12853
  if (m && m->nb_int) {
 
12854
    name = "int";
 
12855
    res = PyNumber_Int(x);
 
12856
  }
 
12857
  else if (m && m->nb_long) {
 
12858
    name = "long";
 
12859
    res = PyNumber_Long(x);
 
12860
  }
 
12861
#else
 
12862
  if (m && m->nb_int) {
 
12863
    name = "int";
 
12864
    res = PyNumber_Long(x);
 
12865
  }
 
12866
#endif
 
12867
  if (res) {
 
12868
#if PY_VERSION_HEX < 0x03000000
 
12869
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
 
12870
#else
 
12871
    if (!PyLong_Check(res)) {
 
12872
#endif
 
12873
      PyErr_Format(PyExc_TypeError,
 
12874
                   "__%s__ returned non-%s (type %.200s)",
 
12875
                   name, name, Py_TYPE(res)->tp_name);
 
12876
      Py_DECREF(res);
 
12877
      return NULL;
 
12878
    }
 
12879
  }
 
12880
  else if (!PyErr_Occurred()) {
 
12881
    PyErr_SetString(PyExc_TypeError,
 
12882
                    "an integer is required");
 
12883
  }
 
12884
  return res;
 
12885
}
 
12886
 
 
12887
static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
 
12888
  Py_ssize_t ival;
 
12889
  PyObject* x = PyNumber_Index(b);
 
12890
  if (!x) return -1;
 
12891
  ival = PyInt_AsSsize_t(x);
 
12892
  Py_DECREF(x);
 
12893
  return ival;
 
12894
}
 
12895
 
 
12896
static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 
12897
#if PY_VERSION_HEX < 0x02050000
 
12898
   if (ival <= LONG_MAX)
 
12899
       return PyInt_FromLong((long)ival);
 
12900
   else {
 
12901
       unsigned char *bytes = (unsigned char *) &ival;
 
12902
       int one = 1; int little = (int)*(unsigned char*)&one;
 
12903
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
 
12904
   }
 
12905
#else
 
12906
   return PyInt_FromSize_t(ival);
 
12907
#endif
 
12908
}
 
12909
 
 
12910
static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
 
12911
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
 
12912
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
 
12913
       return (size_t)-1;
 
12914
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
 
12915
       PyErr_SetString(PyExc_OverflowError,
 
12916
                       "value too large to convert to size_t");
 
12917
       return (size_t)-1;
 
12918
   }
 
12919
   return (size_t)val;
 
12920
}
 
12921
 
 
12922