From 331844da48e9f3b27567e6fb96d08e350fe4f52c Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 14:12:16 -0500 Subject: [PATCH 01/12] Fix warning --- pandas/_libs/tslibs/c_timestamp.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index f9d1a906207fe..73060ba7f75ea 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -243,6 +243,8 @@ cdef class _Timestamp(datetime): nanos = (other.days * 24 * 60 * 60 * 1000000 + other.seconds * 1000000 + other.microseconds) * 1000 + else: + nanos = 0 result = self.__class__(self.value + nanos, tz=self.tzinfo, freq=self.freq) From ff71fd4031fdfbc634ad4db91da7a45ade39abe3 Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 14:27:08 -0500 Subject: [PATCH 02/12] Fix warning --- pandas/_libs/tslibs/c_timestamp.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index 73060ba7f75ea..5a1f47b0fb6db 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -19,7 +19,7 @@ from cpython cimport (PyObject_RichCompareBool, PyObject_RichCompare, import numpy as np cimport numpy as cnp -from numpy cimport int64_t, int8_t +from numpy cimport int64_t, int8_t, ndarray cnp.import_array() from cpython.datetime cimport (datetime, @@ -322,7 +322,7 @@ cdef class _Timestamp(datetime): cdef: int64_t val dict kwds - int8_t out[1] + ndarray[int8_t] out int month_kw freq = self.freq From ea9d393b90f9f386ed3c3f53b1d14369a9b16c89 Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 14:32:50 -0500 Subject: [PATCH 03/12] Fix cdef --- pandas/_libs/internals.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/internals.pyx b/pandas/_libs/internals.pyx index 0d45897de859a..54ee4753ba332 100644 --- a/pandas/_libs/internals.pyx +++ b/pandas/_libs/internals.pyx @@ -382,7 +382,7 @@ def get_blkno_indexers(int64_t[:] blknos, bint group=True): object blkno list group_order - dict group_slices + dict group_dict int64_t[:] res_view n = blknos.shape[0] From 4ac69335eb66c76cc3a0c2c89b004233c085546f Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 17:56:13 -0500 Subject: [PATCH 04/12] init --- pandas/_libs/tslibs/c_timestamp.pyx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index 5a1f47b0fb6db..6b07afa117853 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -213,7 +213,7 @@ cdef class _Timestamp(datetime): def __add__(self, other): cdef: - int64_t other_int, nanos + int64_t other_int, nanos = 0 if is_timedelta64_object(other): other_int = other.astype('timedelta64[ns]').view('i8') @@ -243,8 +243,6 @@ cdef class _Timestamp(datetime): nanos = (other.days * 24 * 60 * 60 * 1000000 + other.seconds * 1000000 + other.microseconds) * 1000 - else: - nanos = 0 result = self.__class__(self.value + nanos, tz=self.tzinfo, freq=self.freq) From c00b1d35bbe6f2c7d65fffed17a538556a0814ed Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 19:30:15 -0500 Subject: [PATCH 05/12] use npy_bool memoryview --- pandas/_libs/tslibs/c_timestamp.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index 6b07afa117853..e55ff8e7f0df8 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -19,7 +19,7 @@ from cpython cimport (PyObject_RichCompareBool, PyObject_RichCompare, import numpy as np cimport numpy as cnp -from numpy cimport int64_t, int8_t, ndarray +from numpy cimport int64_t, int8_t, ndarray, npy_bool cnp.import_array() from cpython.datetime cimport (datetime, @@ -320,7 +320,7 @@ cdef class _Timestamp(datetime): cdef: int64_t val dict kwds - ndarray[int8_t] out + npy_bool[:] out int month_kw freq = self.freq From a45bfe1d152183e53e7457705368da844c28b18d Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 21:01:44 -0500 Subject: [PATCH 06/12] debug CI-only failure --- pandas/_libs/tslibs/c_timestamp.pxd | 2 +- pandas/_libs/tslibs/c_timestamp.pyx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pxd b/pandas/_libs/tslibs/c_timestamp.pxd index e41197d0f20a2..1fdbd26047dff 100644 --- a/pandas/_libs/tslibs/c_timestamp.pxd +++ b/pandas/_libs/tslibs/c_timestamp.pxd @@ -9,7 +9,7 @@ cdef class _Timestamp(datetime): int64_t value, nanosecond object freq list _date_attributes - cpdef bint _get_start_end_field(self, str field) + cpdef bint _get_start_end_field(self, str field) except -1 cpdef _get_date_name_field(self, object field, object locale) cdef int64_t _maybe_convert_value_to_local(self) cpdef to_datetime64(self) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index e55ff8e7f0df8..872ac4b444edd 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -316,11 +316,11 @@ cdef class _Timestamp(datetime): val = tz_convert_single(self.value, UTC, self.tz) return val - cpdef bint _get_start_end_field(self, str field): + cpdef bint _get_start_end_field(self, str field) except -1: cdef: int64_t val dict kwds - npy_bool[:] out + int8_t out[1] # npy_bool[:] out int month_kw freq = self.freq From ced7c9160d05d2a09996f20aebbd6c8d6756566d Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 21:03:53 -0500 Subject: [PATCH 07/12] CI --- pandas/_libs/tslibs/c_timestamp.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index 872ac4b444edd..2e25037dfbdd0 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -320,7 +320,7 @@ cdef class _Timestamp(datetime): cdef: int64_t val dict kwds - int8_t out[1] # npy_bool[:] out + npy_bool[:] out int month_kw freq = self.freq From d0da7a149fc8bb444ec50589de855d53eebe155d Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 22:03:13 -0500 Subject: [PATCH 08/12] Scrap it --- pandas/_libs/tslibs/c_timestamp.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index 2e25037dfbdd0..c43e74594b23b 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -320,7 +320,7 @@ cdef class _Timestamp(datetime): cdef: int64_t val dict kwds - npy_bool[:] out + int8_t out[1] out int month_kw freq = self.freq From 9c71d166721fd69c02b4ba854275982e13116570 Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 22:04:03 -0500 Subject: [PATCH 09/12] Scrap it --- pandas/_libs/tslibs/c_timestamp.pxd | 2 +- pandas/_libs/tslibs/c_timestamp.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pxd b/pandas/_libs/tslibs/c_timestamp.pxd index 1fdbd26047dff..e41197d0f20a2 100644 --- a/pandas/_libs/tslibs/c_timestamp.pxd +++ b/pandas/_libs/tslibs/c_timestamp.pxd @@ -9,7 +9,7 @@ cdef class _Timestamp(datetime): int64_t value, nanosecond object freq list _date_attributes - cpdef bint _get_start_end_field(self, str field) except -1 + cpdef bint _get_start_end_field(self, str field) cpdef _get_date_name_field(self, object field, object locale) cdef int64_t _maybe_convert_value_to_local(self) cpdef to_datetime64(self) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index c43e74594b23b..fb98fe9614317 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -316,7 +316,7 @@ cdef class _Timestamp(datetime): val = tz_convert_single(self.value, UTC, self.tz) return val - cpdef bint _get_start_end_field(self, str field) except -1: + cpdef bint _get_start_end_field(self, str field): cdef: int64_t val dict kwds From 801fc994d3930dfe1102d53c0e2f85620c2fe5bd Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 22:07:14 -0500 Subject: [PATCH 10/12] Scrap it --- pandas/_libs/tslibs/c_timestamp.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index fb98fe9614317..270f19bc6f20a 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -19,7 +19,7 @@ from cpython cimport (PyObject_RichCompareBool, PyObject_RichCompare, import numpy as np cimport numpy as cnp -from numpy cimport int64_t, int8_t, ndarray, npy_bool +from numpy cimport int64_t, int8_t cnp.import_array() from cpython.datetime cimport (datetime, From 9a7eb0b912982a771138c4758335241b7d5f29c2 Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 22:07:56 -0500 Subject: [PATCH 11/12] last one --- pandas/_libs/tslibs/c_timestamp.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/c_timestamp.pyx b/pandas/_libs/tslibs/c_timestamp.pyx index 270f19bc6f20a..2d3ea3e14775e 100644 --- a/pandas/_libs/tslibs/c_timestamp.pyx +++ b/pandas/_libs/tslibs/c_timestamp.pyx @@ -320,7 +320,7 @@ cdef class _Timestamp(datetime): cdef: int64_t val dict kwds - int8_t out[1] out + int8_t out[1] int month_kw freq = self.freq From 085a0623e282660bb8577fa9edfca0c5d79d1a2a Mon Sep 17 00:00:00 2001 From: pilkibun Date: Fri, 12 Jul 2019 22:16:07 -0500 Subject: [PATCH 12/12] fix warning --- pandas/_libs/window.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/window.pyx b/pandas/_libs/window.pyx index 46e4b17b8164c..0a986942d2a09 100644 --- a/pandas/_libs/window.pyx +++ b/pandas/_libs/window.pyx @@ -1682,7 +1682,7 @@ def roll_window(ndarray[float64_t, ndim=1, cast=True] values, Assume len(weights) << len(values) """ cdef: - ndarray[float64_t] output, tot_wgt, counts + float64_t[:] output, tot_wgt, counts Py_ssize_t in_i, win_i, win_n, in_n float64_t val_in, val_win, c, w