Replace f-strings with @ in dataframe query

This commit is contained in:
coolneng 2021-05-20 00:18:15 +02:00
parent 550f0bb043
commit ceea2d8824
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 4 additions and 2 deletions

View File

@ -39,7 +39,8 @@ def explore_solutions(solutions, data, index):
def remove_duplicates(current, previous, data): def remove_duplicates(current, previous, data):
duplicate_free_df = data.query( 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 return duplicate_free_df

View File

@ -9,7 +9,8 @@ def get_first_random_solution(m, data):
def element_in_dataframe(solution, element): def element_in_dataframe(solution, element):
duplicates = solution.query( 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 return not duplicates.empty