-
Notifications
You must be signed in to change notification settings - Fork 77
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
Creating a helper function dassert_no_duplicates_dict_keys
in hpandas
#1091
Comments
I just wanted some clarity on creating this function. Are we trying to stop overwriting the key entry if it already exists or we want the latest entry as Python does by default. @gpsaggese, @samarth9008 |
We want to check and assert if there are duplicate entries. |
For dictionary keys that can be achieved using |
Could there be any other way to check the duplicate keys? like a hack or something out of the box. |
I don't think there is a solution to check for a duplicate key entry if it is done in the dictionary itself, i.e. while defining it. For example:
will simply be overwritten and we will get:
If we want to update the dictionary we can put a condition to provide a new key entry that does not exist previously or if we are creating a dictionary using something like a list which has multiple key entries and want to append/ update rather than overwriting it we can use something like |
Any word on this one @samarth9008. |
Follow up on #1075
We want to add a new helper function
dassert_no_duplicates_dict_keys
here.Also, we need to add unit tests for the new function. Apart from that, we want to remove
hdbg.dassert_no_duplicates
calls in the codebase with dictionary keys as an input.FYI @samarth9008
The text was updated successfully, but these errors were encountered: