File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def human_traffic(stadium: pd.DataFrame) -> pd.DataFrame:
2525    # I filter only the rows where people >= 100, sort by 'id', and reset index 
2626    temp_df  =  stadium [stadium ['people' ] >=  100 ].sort_values (by = 'id' ).reset_index (drop = True )
2727    if  temp_df .empty :
28-         return  pd . DataFrame ( columns = stadium . columns ) 
28+                  return  temp_df 
2929
3030    result  =  []
3131    current_seq  =  [temp_df .loc [0 , 'id' ]]  # I initialize the sequence with the first valid ID 
@@ -62,7 +62,7 @@ def human_traffic(stadium: pd.DataFrame) -> pd.DataFrame:
6262
6363def  human_traffic (stadium : pd .DataFrame ) ->  pd .DataFrame :
6464    # I filter rows where people >= 100 and sort by 'id' 
65-     stadium  =  stadium .sort_values ( 'id' ). query ('people >= 100' )
65+     stadium  =  stadium .query ('people >= 100'  ). sort_values ( 'id '
6666
6767    # I create a grouping key using index difference trick: id - index 
6868    stadium ['id_exp_diff' ] =  stadium ['id' ] -  range (len (stadium ))
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments