Skip to content

Commit

Permalink
Fixed df reassignment warning on dataframe view.
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Mittal <[email protected]>
  • Loading branch information
varunmittal91 committed Nov 22, 2023
1 parent cb91c95 commit 17e03d7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions focus_validator/rules/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ def check_sql_query(df_groups, sql_query, column_alias):

# for the given indexes in false_indexes list, we are extracting the rows from the dataframe and
# add column_alias value to failure_case column and index to index column
failure_cases = df[df.index.isin(false_indexes)]
failure_cases["failure_case"] = df.apply(
lambda row: {column: row[column] for column in column_alias}, axis=1
)
failure_cases["failure_case"] = df.apply(
failure_cases = df[df.index.isin(false_indexes)].copy()
failure_cases["failure_case"] = failure_cases.apply(
lambda row: ",".join(
[f"{column}:{row[column]}" for column in column_alias]
),
Expand Down

0 comments on commit 17e03d7

Please sign in to comment.