feat: preserve field order when replacing existing fields in with_field#3681
Conversation
|
The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR3681 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
|
@DylanModesitt It may be worth extracting |
|
@all-contributors please add @DylanModesitt for code |
|
I've put up a pull request to add @DylanModesitt! 🎉 |
ianna
left a comment
There was a problem hiding this comment.
@DylanModesitt - This is great! Thank you for fixing it. The tests pass, please, go ahead and merge it if you have finished with it. Thanks!
|
@ianna Thanks you! Think it will need another review approval with write access (required a merge commit). I'm happy to merge it once there is another approval or feel free to do so (I am finished). |
Closes: #3680
This PR modifies
ak.with_fieldto preserve field order when replacing existing fields. Previously, replacing a field would remove it from its original position and append it to the end.Changes
_implinsrc/awkward/operations/ak_with_field.pyto detect when replacing vs. adding fieldstests/test_3681_preserve_field_order_with_field.pyBefore:
After: