Skip to content

Commit dd92b7a

Browse files
oktieelronbandel
andauthored
Fix duplicate-column sorting issue in Text2SQL evaluation utils (#1954)
bug fix for dfs w/ duplicate cols Signed-off-by: Oktie Hassanzadeh <hassanzadeh@us.ibm.com> Co-authored-by: Elron Bandel <elronbandel@gmail.com>
1 parent a99cd9b commit dd92b7a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/unitxt/text2sql_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,10 @@ def rows_to_multisets(df):
856856

857857
def sort_df(df):
858858
sorted_df = df.copy()
859-
for col in sorted_df.columns:
860-
sorted_df[col] = sorted_df[col].astype(str).sort_values(ignore_index=True)
859+
for i in range(len(sorted_df.columns)):
860+
sorted_df.iloc[:, i] = (
861+
sorted_df.iloc[:, i].astype(str).sort_values(ignore_index=True)
862+
)
861863
return sorted_df
862864

863865
if df1.empty or df2.empty or len(df1) != len(df2):

0 commit comments

Comments
 (0)