File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -559,10 +559,20 @@ def _drop_status_col(samples_df):
559559 status_cols = []
560560 # we know the first 3 columns will be the time, xpos, ypos
561561 for col in samples_df .columns [3 :]:
562- if samples_df [col ][0 ][0 ].isnumeric ():
563- # if the value is numeric, it's not a status column
562+ first_valid_index = samples_df [col ].first_valid_index ()
563+ if first_valid_index is None :
564+ # The entire column is NaN, so we can drop it
565+ status_cols .append (col )
564566 continue
565- if len (samples_df [col ][0 ]) in [3 , 5 , 13 , 17 ]:
567+ value = samples_df .loc [first_valid_index , col ]
568+ try :
569+ float (value )
570+ continue # if the value is numeric, it's not a status column
571+ except (ValueError , TypeError ):
572+ # cannot convert to float, so it might be a status column
573+ pass
574+ # further check the length of the string value
575+ if len (value ) in [3 , 5 , 13 , 17 ]:
566576 status_cols .append (col )
567577 return samples_df .drop (columns = status_cols )
568578
You can’t perform that action at this time.
0 commit comments