@@ -269,15 +269,36 @@ def _collect_samples(
269269 end = r ["value" ]["end" ]
270270 label = r ["value" ]["timeserieslabels" ][0 ]
271271
272+ # Convert start/end to same type as time column for comparison
273+ time_dtype = df [params ["time_col" ]].dtype
274+ logger .debug (f"Task { task_id } : Converting time range [{ start } , { end } ] to match column dtype { time_dtype } " )
275+ try :
276+ if 'int' in str (time_dtype ):
277+ start = int (float (start ))
278+ end = int (float (end ))
279+ elif 'float' in str (time_dtype ):
280+ start = float (start )
281+ end = float (end )
282+ # For string/datetime, keep as is
283+ logger .debug (f"Task { task_id } : Converted to [{ start } , { end } ]" )
284+ except (ValueError , TypeError ) as e :
285+ logger .warning (f"Could not convert start={ start } , end={ end } to { time_dtype } : { e } , using original values" )
286+
272287 # Find rows in this time range
273- mask = (df [params ["time_col" ]] >= start ) & (
274- df [params ["time_col" ]] <= end
275- )
288+ try :
289+ mask = (df [params ["time_col" ]] >= start ) & (
290+ df [params ["time_col" ]] <= end
291+ )
292+ except TypeError as e :
293+ logger .error (f"Task { task_id } : Type error comparing times - start={ start } ({ type (start )} ), end={ end } ({ type (end )} ), time_col dtype={ time_dtype } : { e } " )
294+ # Skip this annotation if we can't compare
295+ continue
276296
277297 # Set the appropriate label index
278298 label_idx = label2idx [label ]
279299 row_labels [mask ] = label_idx
280300 labeled_rows += mask .sum ()
301+ logger .debug (f"Task { task_id } : Labeled { mask .sum ()} rows with '{ label } ' (index { label_idx } )" )
281302
282303 # Add ALL rows to training data
283304 X_list .append (df [params ["channels" ]].values .astype (np .float32 ))
0 commit comments