-
Notifications
You must be signed in to change notification settings - Fork 89
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
Apply NumPy's random functions using awkward inputs? #489
Comments
The reason it's not working is because they're isn't an Awkward function overriding this NumPy function. That would be a good feature to add (hadn't thought of it), and it would be a whole new category of overload (it doesn't quite belong in ak.operations.structure, though it would be implemented in a similar way). For the time being, I guess you'd have to unwrap the |
Thank you! There is something I want to clarify:
How exactly can I do this? (Sorry I'm just starting to learn awkward). So suppose I did the following:
What should I do to convert |
(I'm waiting from a phone, so it's hard to give examples.) The |
Well then I guess I would do this to make a new awkward array with the same offset?
|
This is my whole function, would it be similar to what you have in mind for future implementation?
|
Your NumpyArray is unnecessarily wrapped ( Oh! I guess the reason you wrapped and unwrapped the NumpyArray is because you didn't know it was called that. |
Thanks for your help! |
I'm reopening this as a reminder to add the feature. |
Ok, also if you can point me to where to look at I'll be willing to make the PR for the feature too! |
I'll want to start a new submodule for this, so it might be done before there's enough of a pattern to build on. However, I could start with the randomization functions and if there are any others you need, it should be clear how to build on that pattern. |
Closing this one because it's a time-traveling duplicate. |
Hello,
Thanks for the excellent work!! So I'm working on an application where I want to apply
np.random.normal
on each element of the awkward array. I'm trying to do the followings:I'm wondering if anyone here have suggestions as to what I should do in this case. 😄 Our solution right now is to basically do nested loops to change each element, which is not very efficient.
The text was updated successfully, but these errors were encountered: