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

Change consecutive parameter in unique_key to bool #244

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

qubixes
Copy link
Member

@qubixes qubixes commented Feb 1, 2024

Fixes #237

@qubixes qubixes marked this pull request as ready for review February 1, 2024 09:52
@@ -146,8 +146,8 @@ def _fit(cls, values):
lower = values.min()
high = values.max() + 1
if len(values) == high-lower and np.all(values.to_numpy() == np.arange(lower, high)):
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this comparison is slightly inefficient?

Copy link
Member Author

Choose a reason for hiding this comment

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

How would you prefer to do it?

Copy link
Member

Choose a reason for hiding this comment

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

not sure, in R I'd do all(diff(values) == 1) then we don't need to instantiate a completely new vector which might be a million values. But it's a super small comment which you could ignore as well

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't actually know if np.arange will instantiate a new vector. Let's for now keep it like it is. I don't think this will really ever be a bottleneck, and if so we can revise then.

@qubixes qubixes merged commit 8f6d6b7 into main Feb 2, 2024
6 checks passed
@qubixes qubixes deleted the unique_key_boolean branch February 19, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UniqueKeyDistribution consecutive param bool?
2 participants