From ceea2d8824312413194000fd4271fe82136868c6 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 20 May 2021 00:18:15 +0200 Subject: [PATCH] Replace f-strings with @ in dataframe query --- src/greedy.py | 3 ++- src/local_search.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/greedy.py b/src/greedy.py index 2c74a82..e686426 100644 --- a/src/greedy.py +++ b/src/greedy.py @@ -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 diff --git a/src/local_search.py b/src/local_search.py index 3567ba6..8237dee 100644 --- a/src/local_search.py +++ b/src/local_search.py @@ -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