-
Notifications
You must be signed in to change notification settings - Fork 7
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
Allow processing of duplicated attribute data columns #203
Merged
+9
−2
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fab9f98
Allow processing of duplicated data columns
olejandro 9762b79
Update version of demos used for benchmarks
olejandro 8329c52
Drop duplicates after convert_aliases
olejandro 83edd40
Merge branch 'main' into olex/process-dupes
olejandro 4e59fe8
Revert version of demos used for benchmarks
olejandro 7bcffc1
Revert drop duplicates
olejandro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(edited - I misunderstood the logic here originally)
This doesn't throw an exception for austimes, but it seems to retains the duplicated columns, which then get turned into duplicate rows after the explode, e.g. the first row, which looks like this when passed into explode():
just gets exploded into this at the end of the function, retaining the duplicate
fixom
columns (I appended the name column for clarity):This happens to be ok in this particular example because the values are identical, but if, say, the second
fixom
value wasNone
, then dropping first duplicate rows would give the wrong answer later.Whereas I understood that we want to want to 'fill-right' their values before exploding (e.g. using the merge function from #198) - so that any missing values in the right-most column get filled with non-missing values from the next column to the left, etc.
Suggest we replace this (assuming the attribute/alias stuff is sorted at this point) with:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamRWest, as I've tried to explain in #198, there may be an attribute alias, e.g.:
Using your approach will turn this to:
It will later be transformed into :
Resulting in an incorrect
NCAP_START
value forPRC2
, because the rows below overwrite the rows above.What I try to ensure with my changes is that the original table results in:
This way the
NCAP_START
value forPRC2
will be correct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the approach proposed in #198 should be applied in
normalize_column_aliases
and only apply to columns not inconfig.all_attributes
andconfig.attr_aliases
sets.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamRWest, I've modified Demo 7 to cover this case. It seems to be working fine. Also we normally do drop rows with invalid values before doing any kind of overwritting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok, I think I get it (didn't realise how aliases worked before). The explode() and later dropping of duplicate rows kind of does the work or resolving duplicates for you.
If you have time, it'd probably be worth writing a unit test to spell this logic out. But if you've checked that it matches VEDA, then that's the main thing, so I'm happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sure! Tbh, I have never written one, but there is always the first time. 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to it, just make a fake dataframe (like your examples above) run it through the appropriate transforms, and
assert
what it should look like on the other end.All the boilerplate is already set up in
test_transforms.py
, so just make a newtest_whatever()
function in there, and it'll get checked in every CI run so we don't accidentally change the desired behaviour later.