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

[FEA] Python bindings for column_view::child #7608

Closed
firestarman opened this issue Mar 16, 2021 · 3 comments · Fixed by #7757
Closed

[FEA] Python bindings for column_view::child #7608

firestarman opened this issue Mar 16, 2021 · 3 comments · Fixed by #7757
Assignees
Labels
feature request New feature or request Python Affects Python cuDF API.

Comments

@firestarman
Copy link
Contributor

cpp has already supported extracting child columns by index for a column of nested type. It will be much helpful to plumb through to Python.

What's more, it exists in JNI already.

I'm not sure what the Python API should look like. For example we could have:

s = cudf.Series([{"a": 1, "b": "s1"}, {"a": 2, "b": "s2"}])
s.struct.a  # returns Series([1, 2])
s.struct.b  # returns Series(["s1", "s2"])

or alternatively:

s.struct[0]  # returns Series([1, 2])
s.struct[1]  # returns Series(["s1", "s2"])
@firestarman firestarman added feature request New feature or request Needs Triage Need team to review and classify labels Mar 16, 2021
@firestarman firestarman changed the title [FEA] Python bindings for lists::extract_lists_element [FEA] Python bindings for column_view::child Mar 16, 2021
@firestarman firestarman added the Python Affects Python cuDF API. label Mar 16, 2021
@skirui-source skirui-source self-assigned this Mar 23, 2021
@kkraus14 kkraus14 removed the Needs Triage Need team to review and classify label Mar 25, 2021
@kkraus14
Copy link
Collaborator

PyArrow does this via a field operator that can take in either a name of the column or the position, where I think it would make sense for us to follow:

s = cudf.Series([{"a": 1, "b": "s1"}, {"a": 2, "b": "s2"}])

s.struct.field('a') # returns Series([1, 2])
s.struct.field(0) # returns Series([1, 2])

s.struct.field('b') # returns Series(["s1", "s2"])
s.struct.field(1) # returns Series(["s1", "s2"])

@skirui-source
Copy link
Contributor

Not sure why this issue is still open? @kkraus14

@kkraus14
Copy link
Collaborator

kkraus14 commented Apr 7, 2021

Not sure why this issue is still open? @kkraus14

Not sure, closing, thanks @skirui-source!

@kkraus14 kkraus14 closed this as completed Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants