Skip to content

Commit 9d1889a

Browse files
committed
is_null only if really needed
1 parent 5cde722 commit 9d1889a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pandas/_libs/hashtable_func_helper.pxi.in

+1-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna):
4242

4343
# Don't use Py_ssize_t, since table.n_buckets is unsigned
4444
khiter_t k
45-
bint is_null
4645

4746
{{c_type}} val
4847

@@ -61,8 +60,7 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna):
6160

6261
for i in range(n):
6362
val = values[i]
64-
is_null = checknull(val)
65-
if not is_null or not dropna:
63+
if not dropna or not checknull(val):
6664
k = kh_get_{{ttype}}(table, <PyObject*>val)
6765
if k != table.n_buckets:
6866
table.vals[k] += 1

0 commit comments

Comments
 (0)