Skip to content
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

ones/zeroes_like numpy equivalents #493

Closed
andrzejnovak opened this issue Oct 21, 2020 · 0 comments · Fixed by #535
Closed

ones/zeroes_like numpy equivalents #493

andrzejnovak opened this issue Oct 21, 2020 · 0 comments · Fixed by #535
Labels
feature New feature or request good first issue Good for newcomers

Comments

@andrzejnovak
Copy link
Member

andrzejnovak commented Oct 21, 2020

Unlike this,

>>> import awkward1 as ak
>>> ar = ak.Array([[1, 2, 3], [], [4, 5]])
>>> ak.broadcast_arrays(ar, 1)
[<Array [[1, 2, 3], [], [4, 5]] type='3 * var * int64'>, <Array [[1, 1, 1], [], [1, 1]] type='3 * var * int64'>]
>>> ak.broadcast_arrays(ar, 1.0)
[<Array [[1, 2, 3], [], [4, 5]] type='3 * var * int64'>, <Array [[1, 1, 1], [], [1, 1]] type='3 * var * float64'>]

it should take its types from the data in ar. If ar is a record with x and y fields of different types, the 1's or 0's should have the same types as those fields. (I.e. it should be possible to have uint8 or whatever.)

Also, np.zeros_like for strings returns empty strings, and np.ones_like for strings returns strings with "1" in them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
2 participants