From fd86b6417cd59c05a78922f4ded9e1ca792a0a5b Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 28 Feb 2020 14:24:58 +0200 Subject: [PATCH 1/2] CLN: using "n" variable to loop --- pandas/_libs/interval.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/interval.pyx b/pandas/_libs/interval.pyx index 1166768472449..8c509007e13c8 100644 --- a/pandas/_libs/interval.pyx +++ b/pandas/_libs/interval.pyx @@ -509,7 +509,7 @@ def intervals_to_interval_bounds(ndarray intervals, left = np.empty(n, dtype=intervals.dtype) right = np.empty(n, dtype=intervals.dtype) - for i in range(len(intervals)): + for i in range(n): interval = intervals[i] if interval is None or util.is_nan(interval): left[i] = np.nan From ea2d8426879e20369a53ef7da499b2ddb4970138 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 28 Feb 2020 14:27:33 +0200 Subject: [PATCH 2/2] cdef for "i" as index and for "n" as the length --- pandas/_libs/interval.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/interval.pyx b/pandas/_libs/interval.pyx index 8c509007e13c8..50ac055dbffc9 100644 --- a/pandas/_libs/interval.pyx +++ b/pandas/_libs/interval.pyx @@ -502,7 +502,7 @@ def intervals_to_interval_bounds(ndarray intervals, """ cdef: object closed = None, interval - int64_t n = len(intervals) + Py_ssize_t i, n = len(intervals) ndarray left, right bint seen_closed = False