Skip to content

Commit 28317f5

Browse files
jbrockmendeljreback
authored andcommitted
remove unused row_bool_subset (#27466)
1 parent 0e05f55 commit 28317f5

File tree

2 files changed

+2
-54
lines changed

2 files changed

+2
-54
lines changed

pandas/_libs/lib.pyx

-44
Original file line numberDiff line numberDiff line change
@@ -688,50 +688,6 @@ def generate_bins_dt64(ndarray[int64_t] values, const int64_t[:] binner,
688688
return bins
689689

690690

691-
@cython.boundscheck(False)
692-
@cython.wraparound(False)
693-
def row_bool_subset(const float64_t[:, :] values,
694-
ndarray[uint8_t, cast=True] mask):
695-
cdef:
696-
Py_ssize_t i, j, n, k, pos = 0
697-
ndarray[float64_t, ndim=2] out
698-
699-
n, k = (<object>values).shape
700-
assert (n == len(mask))
701-
702-
out = np.empty((mask.sum(), k), dtype=np.float64)
703-
704-
for i in range(n):
705-
if mask[i]:
706-
for j in range(k):
707-
out[pos, j] = values[i, j]
708-
pos += 1
709-
710-
return out
711-
712-
713-
@cython.boundscheck(False)
714-
@cython.wraparound(False)
715-
def row_bool_subset_object(ndarray[object, ndim=2] values,
716-
ndarray[uint8_t, cast=True] mask):
717-
cdef:
718-
Py_ssize_t i, j, n, k, pos = 0
719-
ndarray[object, ndim=2] out
720-
721-
n, k = (<object>values).shape
722-
assert (n == len(mask))
723-
724-
out = np.empty((mask.sum(), k), dtype=object)
725-
726-
for i in range(n):
727-
if mask[i]:
728-
for j in range(k):
729-
out[pos, j] = values[i, j]
730-
pos += 1
731-
732-
return out
733-
734-
735691
@cython.boundscheck(False)
736692
@cython.wraparound(False)
737693
def get_level_sorter(const int64_t[:] label,

pandas/core/groupby/ops.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
ensure_float64,
2121
ensure_int64,
2222
ensure_int_or_float,
23-
ensure_object,
2423
ensure_platform_int,
2524
is_bool_dtype,
2625
is_categorical_dtype,
@@ -567,15 +566,8 @@ def _cython_operation(self, kind, values, how, axis, min_count=-1, **kwargs):
567566
result[mask] = np.nan
568567

569568
if kind == "aggregate" and self._filter_empty_groups and not counts.all():
570-
if result.ndim == 2:
571-
try:
572-
result = lib.row_bool_subset(result, (counts > 0).view(np.uint8))
573-
except ValueError:
574-
result = lib.row_bool_subset_object(
575-
ensure_object(result), (counts > 0).view(np.uint8)
576-
)
577-
else:
578-
result = result[counts > 0]
569+
assert result.ndim != 2
570+
result = result[counts > 0]
579571

580572
if vdim == 1 and arity == 1:
581573
result = result[:, 0]

0 commit comments

Comments
 (0)