Skip to content

Commit ed65b30

Browse files
committed
Cleaned up call signature
1 parent 9f2b006 commit ed65b30

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pandas/_libs/groupby_helper.pxi.in

+7-1
Original file line numberDiff line numberDiff line change
@@ -882,12 +882,18 @@ def group_cummax_{{name}}(ndarray[{{dest_type2}}, ndim=2] out,
882882
@cython.boundscheck(False)
883883
@cython.wraparound(False)
884884
def group_any(ndarray[int64_t] out,
885-
ndarray[int64_t] mask,
885+
ndarray values,
886886
ndarray[int64_t] labels,
887887
bint skipna):
888888
cdef:
889889
Py_ssize_t i, N=len(labels)
890890
int64_t lab
891+
ndarray[int64_t] mask
892+
893+
if values.dtype is np.object:
894+
mask = np.array(bool(x) for x in values).astype(np.int64)
895+
else:
896+
mask = values.astype(np.bool).astype(np.int64)
891897

892898
with nogil:
893899
for i in range(N):

pandas/core/groupby.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -1223,18 +1223,12 @@ class GroupBy(_GroupBy):
12231223
@Appender(_doc_template)
12241224
def any(self, skipna=True):
12251225
"""Returns True if any value in the group is truthful, else False"""
1226-
obj = self._obj_with_exclusions
1227-
12281226
labels, _, _ = self.grouper.group_info
1229-
12301227
output = collections.OrderedDict()
1228+
12311229
for name, obj in self._iterate_slices():
12321230
result = np.zeros(self.ngroups, dtype=np.int64)
1233-
if obj.dtype is np.object:
1234-
mask = np.array(bool(x) for x in obj.values)
1235-
else:
1236-
mask = obj.values.astype(np.bool)
1237-
libgroupby.group_any(result, mask.astype(np.int64), labels, skipna)
1231+
libgroupby.group_any(result, obj.values, labels, skipna)
12381232
output[name] = result.astype(np.bool)
12391233

12401234
return self._wrap_aggregated_output(output)

0 commit comments

Comments
 (0)