Skip to content

CLN: remove unused sparse reindex #43627

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

Merged
merged 4 commits into from
Sep 17, 2021
Merged
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
71 changes: 0 additions & 71 deletions pandas/_libs/sparse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -229,45 +229,6 @@ cdef class IntIndex(SparseIndex):
results[mask] = res
return results

cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,
float64_t fill_value, SparseIndex other_):
cdef:
Py_ssize_t i = 0, j = 0
IntIndex other
ndarray[float64_t, ndim=1] result
ndarray[int32_t, ndim=1] sinds, oinds

other = other_.to_int_index()

oinds = other.indices
sinds = self.indices

result = np.empty(other.npoints, dtype=np.float64)
result[:] = fill_value

for i in range(other.npoints):
while oinds[i] > sinds[j] and j < self.npoints:
j += 1

if j == self.npoints:
break

if oinds[i] < sinds[j]:
continue
elif oinds[i] == sinds[j]:
result[i] = values[j]
j += 1

return result

cpdef put(self, ndarray[float64_t, ndim=1] values,
ndarray[int32_t, ndim=1] indices, object to_put):
pass

cpdef take(self, ndarray[float64_t, ndim=1] values,
ndarray[int32_t, ndim=1] indices):
pass


cpdef get_blocks(ndarray[int32_t, ndim=1] indices):
cdef:
Expand Down Expand Up @@ -585,38 +546,6 @@ cdef class BlockIndex(SparseIndex):
cum_len += lens[j]
return results

cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,
float64_t fill_value, SparseIndex other_):
cdef:
Py_ssize_t i = 0, j = 0, ocur, ocurlen
BlockIndex other
ndarray[float64_t, ndim=1] result
ndarray[int32_t, ndim=1] slocs, slens, olocs, olens

other = other_.to_block_index()

olocs = other.blocs
olens = other.blengths
slocs = self.blocs
slens = self.blengths

result = np.empty(other.npoints, dtype=np.float64)

for i in range(other.nblocks):
ocur = olocs[i]
ocurlen = olens[i]

while slocs[j] + slens[j] < ocur:
j += 1

cpdef put(self, ndarray[float64_t, ndim=1] values,
ndarray[int32_t, ndim=1] indices, object to_put):
pass

cpdef take(self, ndarray[float64_t, ndim=1] values,
ndarray[int32_t, ndim=1] indices):
pass


@cython.internal
cdef class BlockMerge:
Expand Down