new dummy function

This commit is contained in:
=
2025-08-27 21:37:21 -04:00
parent bae3d41e34
commit 51d56bae4b
2 changed files with 26 additions and 5 deletions
+4 -5
View File
@@ -72,18 +72,16 @@ def add_longest_common_two_local(df, col="filename_x", new_col="longestcfp", min
return df
def export_groups_for_review(df, col="filename_x", group_col="longestcfp", csv_path="filegroups_review.csv"):
def export_groups_for_review(df, col="filename_x", group_col="longestcfp"):
"""
Compute longest common paths, group filepaths, write CSV for review.
"""
df = add_longest_common_two_local(df, col=col, new_col=group_col)
grouped = df.groupby(group_col)[col].apply(list).reset_index()
grouped.to_csv(csv_path, index=False)
print(f"Grouped file list saved to: {csv_path}")
return grouped, df
def mask_from_csv(df, csv_path, filepath_col="filename_x", group_col="longestcfp"):
def mask_from_csv(df, csv_path, filepath_col):
"""
Reads reviewed CSV of groups, keeps only files in approved groups.
"""
@@ -98,7 +96,8 @@ def mask_from_csv(df, csv_path, filepath_col="filename_x", group_col="longestcfp
# Keep only rows in df that are in approved_files
masked_df = df[df[filepath_col].isin(approved_files)].copy()
return masked_df
remainder = df[~df[filepath_col].isin(approved_files)].copy()
return masked_df, remainder
def filter_and_drop(approved, eligiblepaths, min_hashes):
"""