Consider making the DataFrame API less verbose by imitating Polars
- Lingua principale
- Rust
- Stelle
- 9.3k
- Fork
- 2.4k
- Merge medio
- 3g 11h
- PR unite (30g)
- 360
Descrizione
**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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia individuando i metodi dell’API DataFrame denominati select e select_columns, quindi esamina le loro firme attuali e l’utilizzo nelle vicinanze. Confronta il comportamento generico di selezione proposto con la gestione esistente delle colonne e delle espressioni complesse; il lavoro dovrebbe considerarsi completato quando esiste un design dell’API concordato e coerente che copra sia i literal concisi sia le collezioni generate programmaticamente, senza lasciare irrisolto il comportamento delle espressioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- backend-api-design, data
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100