Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Implement select_columns #39

Merged
merged 1 commit into from
Mar 15, 2022
Merged

Implement select_columns #39

merged 1 commit into from
Mar 15, 2022

Conversation

andygrove
Copy link
Contributor

No description provided.

@andygrove andygrove requested a review from jimexist March 10, 2022 14:24
@@ -51,6 +51,12 @@ impl PyDataFrame {
self.df.schema().into()
}

#[args(args = "*")]
fn select_columns(&self, args: Vec<&str>) -> PyResult<Self> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can instead provide __getitem__ which is more pythonic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, i think we could have both 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been looking at the python documentation for __getitem__ but it isn't clear to me how this would apply here for selecting multiple columns?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the idea is to index by list:

df[["a", "b"]]

@jimexist jimexist merged commit cc1649a into datafusion-contrib:main Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants