Skip to content

Commit

Permalink
Fixing row error
Browse files Browse the repository at this point in the history
  • Loading branch information
jcadam14 committed Sep 25, 2024
1 parent df6e246 commit 37b03d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/regtech_data_validator/data_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ def df_to_dicts(df: pl.DataFrame, max_records: int = 10000, max_group_size: int
# Cuts off the number of records. Can't just 'head' on the group due to the dataframe structure.
# So this function uses the group error counts to truncate on record numbers
def truncate_validation_group_records(group, group_size):
need_to_truncate = group.select(pl.col('record_no').n_unique()).item() > group_size
unique_record_nos = group.select('record_no').unique().limit(group_size)
truncated_group = group.filter(pl.col('record_no').is_in(unique_record_nos['record_no']))
need_to_truncate = group.select(pl.col('row').n_unique()).item() > group_size
unique_record_nos = group.select('row').unique().limit(group_size)
truncated_group = group.filter(pl.col('row').is_in(unique_record_nos['row']))
return truncated_group, need_to_truncate


Expand Down

0 comments on commit 37b03d3

Please sign in to comment.