@@ -566,23 +566,22 @@ def _drop_status_col(samples_df):
566566 status_cols = []
567567 # we know the first 3 columns will be the time, xpos, ypos
568568 for col in samples_df .columns [3 :]:
569- # use first valid index to ignore preceding empty values
569+ # use first valid index and value to ignore leading empty values
570570 # see https://github.com/mne-tools/mne-python/issues/13567
571571 first_valid_index = samples_df [col ].first_valid_index ()
572572 if first_valid_index is None :
573573 # The entire column is NaN, so we can drop it
574574 status_cols .append (col )
575575 continue
576- value = samples_df .loc [first_valid_index , col ]
576+ first_value = samples_df .loc [first_valid_index , col ]
577577 try :
578- float (value )
578+ float (first_value )
579579 continue # if the value is numeric, it's not a status column
580580 except (ValueError , TypeError ):
581581 # cannot convert to float, so it might be a status column
582- pass
583- # further check the length of the string value
584- if len (value ) in [3 , 5 , 13 , 17 ]:
585- status_cols .append (col )
582+ # further check the length of the string value
583+ if len (first_value ) in [3 , 5 , 13 , 17 ]:
584+ status_cols .append (col )
586585 return samples_df .drop (columns = status_cols )
587586
588587
0 commit comments