-
Notifications
You must be signed in to change notification settings - Fork 84
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
Implement unflatten function #583
Conversation
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.
Thanks for doing this! I have only small (explicit) corrections.
One question: do you want to allow missing values (None) in counts
and pass them through to the output? If so, that's most of what the corrections do: they handle that in more generality. (IndexedOptionArray isn't the only node class that provides option-type, there's also ByteMaskedArray, BitMaskedArray, and UnmaskedArray. You don't have to explicitly check for all of these cases; the to_numpy
function with allow_missing=True
does that. See the comments.)
If you don't actually want this feature, if you want to require counts
to only contain integers, then it's simpler (and I describe that, too).
In the corresponding issue, we talked about adding an axis
parameter, but this PR doesn't have to address that. We can add a placeholder and have it raise NotImplementedError for all but the default value.
Thanks for this long comment. I'm learning a lot. Will add the changes later. For the missing values: Yes, I intended to pass them to the output. This is to undo I did not include an |
Nope, I just forgot! No need to include |
Improve documentation Raise errors if counts is valid Handle all option types
Marked it a moment too early as "ready for review" but now everything should be ready for a review. |
…y tested for CuPy.
I noticed that it didn't have tests, so I added them, and that gave me more things to check. Some of these appeared in the Thanks! |
I know this was 4 years ago, but thanks for doing this and I'm sorry that I forgot to add you to the all-contributors list! @all-contributors please add @jrueb for code |
I couldn't determine any contributions to add, did you specify any contributions? I've put up a pull request to add @jrueb! 🎉 |
This implements an
unflatten
function for awkward as described in #555.As I really needed this function and the issue was marked as "good first issue" I thought I would give it a try.
Would you like to have a unit test for the function? I'm not sure as this is my first pull request, but if needed I can write one.
I noticed one problem with
cumsum
while writing this. However, this might need to go into a separate issue. Considerwill raise a
TypeError
. However it will work fine if you changecupy
tonumpy
.