Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: arrow unique, is_duplicated, is_unique #565

Merged
merged 2 commits into from
Jul 21, 2024

Conversation

FBruzzesi
Copy link
Member

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below.

Relevant arrow issue/conversation

@github-actions github-actions bot added the enhancement New feature or request label Jul 21, 2024
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wild, thanks for doing this

Comment on lines +401 to +412
col_token = generate_unique_token(n_bytes=8, columns=columns)
row_count = (
df.append_column(col_token, pa.array(np.arange(len(self))))
.group_by(columns)
.aggregate([(col_token, "count")])
)
is_duplicated = pc.greater(
df.join(
row_count, keys=columns, right_keys=columns, join_type="inner"
).column(f"{col_token}_count"),
1,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too proud of the join, but alternative was looping through value counts :|

@MarcoGorelli MarcoGorelli merged commit e46c88d into main Jul 21, 2024
23 checks passed
@FBruzzesi
Copy link
Member Author

FBruzzesi commented Jul 21, 2024

Was this the fastest review ever?! πŸ˜‚πŸ˜‚

@FBruzzesi FBruzzesi deleted the feat/arrow-frame-unique branch July 21, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants