Skip to content

CLN: remove old skiplist code #13372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions pandas/algos.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1505,52 +1505,8 @@ def roll_kurt(ndarray[double_t] input,
#-------------------------------------------------------------------------------
# Rolling median, min, max

ctypedef double_t (* skiplist_f)(object sl, int n, int p)

cdef _roll_skiplist_op(ndarray arg, int win, int minp, skiplist_f op):
cdef ndarray[double_t] input = arg
cdef double val, prev, midpoint
cdef IndexableSkiplist skiplist
cdef Py_ssize_t nobs = 0, i

cdef Py_ssize_t N = len(input)
cdef ndarray[double_t] output = np.empty(N, dtype=float)

skiplist = IndexableSkiplist(win)

minp = _check_minp(win, minp, N)

for i from 0 <= i < minp - 1:
val = input[i]

# Not NaN
if val == val:
nobs += 1
skiplist.insert(val)

output[i] = NaN

for i from minp - 1 <= i < N:
val = input[i]

if i > win - 1:
prev = input[i - win]

if prev == prev:
skiplist.remove(prev)
nobs -= 1

if val == val:
nobs += 1
skiplist.insert(val)

output[i] = op(skiplist, nobs, minp)

return output

from skiplist cimport *


@cython.boundscheck(False)
@cython.wraparound(False)
def roll_median_c(ndarray[float64_t] arg, int win, int minp):
Expand Down