Consider making the DataFrame API less verbose by imitating Polars
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
I'd say that, for instance, `.select(["name"])` is significantly easier to read and write than `.select(vec![col("name")])`.
**Describe the solution you'd like**
Polars deals with this by having the following more generic signature.
```
pub fn select(&self, selection: I) -> Result
where
I: IntoIterator,
S: AsRef
```
`IntoIterator` makes a lot of sense, it allows for arrays for concise syntax and Vec or any other collection whenever the list is programmatically generated.
`AsRef` is less clear, I'm not sure how they refer to complex expressions with a string reference. Perhaps `Into` might be better with a default implementation for `&str`.
Yes I know that there's also a `select_columns(&self, columns: &[&str])` method in the current API, but it is still less flexible, somewhat redundant, and there are other places where `vec!` and `col()` somewhat pollute the syntax still.
Contributor guide
Research direction
Start by locating the DataFrame API methods named select and select_columns, then inspect their current signatures and nearby usage. Compare the proposed generic selection behavior with existing column and complex-expression handling; done should mean an agreed, consistent API design that covers concise literals and programmatically generated collections without leaving expression behavior unresolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100