[query] teach hl.array to convert 1-d ndarrays#12810
Merged
danking merged 5 commits intohail-is:mainfrom Mar 23, 2023
Merged
Conversation
CHANGELOG: hl.array can now convert 1-d ndarrays into the equivalent list.
We leave the improvement of the implementation of `_data_array` to a future PR.
There was one usage of `_data_array` that I could not convince myself used a 1-d ndarray. Thoughts?
```
# ...
def numpy_to_cols_table(X, field_name):
hail_array = X._data_array()
cols_and_X = hl.zip(A.source_table.index_globals().cols, hail_array).map(lambda tup: tup[0].annotate(**{field_name: tup[1]}))
t = hl.Table.parallelize(cols_and_X, key=A.col_key)
return t
st = None
lt = None
eigens = hl.eval(S * S)
if transpose:
if compute_loadings:
lt = numpy_to_cols_table(V, 'loadings')
# ...
```
patrick-schultz
previously requested changes
Mar 22, 2023
| [1, 2, 3], | ||
| [1, 7], | ||
| [1, 2, 3, 3] | ||
| ) |
Member
There was a problem hiding this comment.
I think you're missing an assertion?
patrick-schultz
approved these changes
Mar 22, 2023
added 2 commits
March 22, 2023 11:05
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CHANGELOG: hl.array can now convert 1-d ndarrays into the equivalent list.
We leave the improvement of the implementation of
_data_arrayto a future PR.