Skip to content

Commit 230215f

Browse files
committed
reorder ifs
1 parent d85b1aa commit 230215f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/_libs/hashtable_func_helper.pxi.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ cpdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna):
112112
for i in range(n):
113113
val = values[i]
114114
is_null = checknull(val)
115-
if is_null:
116-
val = navalue
117115
if not is_null or not dropna:
116+
# all nas become the same representative:
117+
if is_null:
118+
val = navalue
118119
k = kh_get_{{ttype}}(table, <PyObject*>val)
119120
if k != table.n_buckets:
120121
unique_key_index = table.vals[k]

0 commit comments

Comments
 (0)