File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,17 @@ def __init__(self,
6262                self .df  =  pd .read_csv (filename )
6363            else :
6464                self .df  =  df 
65+ 
66+             # we expect the df index to have 'start', which means RangeIndex. 
67+             # most users don't supply their own df, so this is mostly a sanity check 
68+             # for when an advanced user has done filtering and have a IntervalIndex. 
69+             if  not  isinstance (self .df .index , pd .RangeIndex ):
70+                 raise  TypeError (
71+                     f"CSVParser requires a RangeIndex. the supplied DataFrame has a { type (self .df .index )}   index." )
6572        else :
73+             if  df  is  not   None :
74+                 raise  ValueError (
75+                     "Dask mode requires a CSV filename; DataFrame inputs are not supported." )
6676            # It'll impact the number of partitions, and memory usage. 
6777            # TODO: tune this for the best performance. 
6878            cores_used  =  int (CORES_USED_FOR_PARALLELIZATION  *  mp .cpu_count ())
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments