Skip to content

Commit c689a8a

Browse files
authored
CLN: remove build warnings in join_asof indexers & algos (#15188)
1 parent 85c2998 commit c689a8a

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

pandas/src/algos_common_helper.pxi.in

+3-3
Original file line numberDiff line numberDiff line change
@@ -374,22 +374,22 @@ def is_monotonic_{{name}}(ndarray[{{c_type}}] arr, bint timelike):
374374
n = len(arr)
375375

376376
if n == 1:
377-
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
377+
if arr[0] != arr[0] or (timelike and <int64_t>arr[0] == iNaT):
378378
# single value is NaN
379379
return False, False, True
380380
else:
381381
return True, True, True
382382
elif n < 2:
383383
return True, True, True
384384

385-
if timelike and arr[0] == iNaT:
385+
if timelike and <int64_t>arr[0] == iNaT:
386386
return False, False, True
387387

388388
{{nogil_str}}
389389
{{tab}}prev = arr[0]
390390
{{tab}}for i in range(1, n):
391391
{{tab}} cur = arr[i]
392-
{{tab}} if timelike and cur == iNaT:
392+
{{tab}} if timelike and <int64_t>cur == iNaT:
393393
{{tab}} is_monotonic_inc = 0
394394
{{tab}} is_monotonic_dec = 0
395395
{{tab}} break

pandas/src/algos_groupby_helper.pxi.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def group_cummin_{{name}}(ndarray[{{dest_type2}}, ndim=2] out,
580580
"""
581581
cdef:
582582
Py_ssize_t i, j, N, K, size
583-
{{dest_type2}} val, min_val
583+
{{dest_type2}} val, min_val = 0
584584
int64_t lab
585585

586586
N, K = (<object> values).shape
@@ -615,7 +615,7 @@ def group_cummax_{{name}}(ndarray[{{dest_type2}}, ndim=2] out,
615615
"""
616616
cdef:
617617
Py_ssize_t i, j, N, K, size
618-
{{dest_type2}} val, max_val
618+
{{dest_type2}} val, max_val = 0
619619
int64_t lab
620620

621621
N, K = (<object> values).shape

pandas/src/joins_func_helper.pxi.in

+8-9
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def asof_join_backward_{{on_dtype}}_by_{{by_dtype}}(
4141
Py_ssize_t left_pos, right_pos, left_size, right_size, found_right_pos
4242
ndarray[int64_t] left_indexer, right_indexer
4343
bint has_tolerance = 0
44-
{{on_dtype}} tolerance_
45-
{{on_dtype}} diff
44+
{{on_dtype}} tolerance_ = 0
45+
{{on_dtype}} diff = 0
4646
{{table_type}} hash_table
4747
{{by_dtype}} by_value
4848

@@ -106,8 +106,8 @@ def asof_join_forward_{{on_dtype}}_by_{{by_dtype}}(
106106
Py_ssize_t left_pos, right_pos, left_size, right_size, found_right_pos
107107
ndarray[int64_t] left_indexer, right_indexer
108108
bint has_tolerance = 0
109-
{{on_dtype}} tolerance_
110-
{{on_dtype}} diff
109+
{{on_dtype}} tolerance_ = 0
110+
{{on_dtype}} diff = 0
111111
{{table_type}} hash_table
112112
{{by_dtype}} by_value
113113

@@ -236,8 +236,8 @@ def asof_join_backward_{{on_dtype}}(
236236
Py_ssize_t left_pos, right_pos, left_size, right_size
237237
ndarray[int64_t] left_indexer, right_indexer
238238
bint has_tolerance = 0
239-
{{on_dtype}} tolerance_
240-
{{on_dtype}} diff
239+
{{on_dtype}} tolerance_ = 0
240+
{{on_dtype}} diff = 0
241241

242242
# if we are using tolerance, set our objects
243243
if tolerance is not None:
@@ -290,8 +290,8 @@ def asof_join_forward_{{on_dtype}}(
290290
Py_ssize_t left_pos, right_pos, left_size, right_size
291291
ndarray[int64_t] left_indexer, right_indexer
292292
bint has_tolerance = 0
293-
{{on_dtype}} tolerance_
294-
{{on_dtype}} diff
293+
{{on_dtype}} tolerance_ = 0
294+
{{on_dtype}} diff = 0
295295

296296
# if we are using tolerance, set our objects
297297
if tolerance is not None:
@@ -371,4 +371,3 @@ def asof_join_nearest_{{on_dtype}}(
371371
return left_indexer, right_indexer
372372

373373
{{endfor}}
374-

0 commit comments

Comments
 (0)