Replace f-strings with @ in dataframe query
This commit is contained in:
		
							parent
							
								
									550f0bb043
								
							
						
					
					
						commit
						ceea2d8824
					
				@ -39,7 +39,8 @@ def explore_solutions(solutions, data, index):
 | 
			
		||||
 | 
			
		||||
def remove_duplicates(current, previous, data):
 | 
			
		||||
    duplicate_free_df = data.query(
 | 
			
		||||
        f"(source != {current} or destination not in @previous) and (source not in @previous or destination != {current})"
 | 
			
		||||
        "(source != @current or destination not in @previous) and \
 | 
			
		||||
        (source not in @previous or destination != @current)"
 | 
			
		||||
    )
 | 
			
		||||
    return duplicate_free_df
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,8 @@ def get_first_random_solution(m, data):
 | 
			
		||||
 | 
			
		||||
def element_in_dataframe(solution, element):
 | 
			
		||||
    duplicates = solution.query(
 | 
			
		||||
        f"(source == {element.source} and destination == {element.destination}) or (source == {element.destination} and destination == {element.source})"
 | 
			
		||||
        f"(source == {element.source} and destination == {element.destination}) or \
 | 
			
		||||
        (source == {element.destination} and destination == {element.source})"
 | 
			
		||||
    )
 | 
			
		||||
    return not duplicates.empty
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user