Interchange protocol use case: getting certain columns as numpy array
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia con il caso d’uso matplotlib plot("x", "y", data=obj) e con l’API di interoperabilità dei dataframe, in particolare dataframe(), get_column_by_name() e get_buffers(). Determina se la conversione delle colonne selezionate in NumPy rientra nell’ambito e quale API coprirebbe più buffer; il lavoro è concluso quando sono stati concordati un caso d’uso e una direzione per l’API.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I think it's useful to think through concrete use cases on how the interchange protocol could be used, to see if it covers those use cases / the desired APIs are available.
One example use case could be matplotlib's plot("x", "y", data=obj), where matplotlib already supports getting the x and y column of any "indexable" object. Currently they require obj["x"] to give the desired data, but so in theory this support could be extended to any object that supports the dataframe interchange protocol. But at the same time, matplotlib currently also needs those data (AFAIK) as numpy arrays because the low-level plotting code is implemented in such a way.
With the current API, matplotlib could do something like:
df = obj.__dataframe__()
x_values = some_utility_func(df.get_column_by_name("x").get_buffers())
where some_utility_func can convert the dict of Buffer objects to a numpy array (once numpy supports dlpack, converting the Buffer objects to numpy will become easy, but the function will then still need to handle potentially multiple buffers returned from get_buffers()).
That doesn't seem ideal: 1) writing the some_utility_func to do the conversion to numpy is non-trivial to implement for all different cases, 2) should an end-user library have to go down to the Buffer objects?
This isn't a pure interchange from one dataframe library to another, so we could also say that this use case is out-of-scope at the moment. But on the other hand, it seems a typical use case example, and could in theory already be supported right now (it only needs the "dataframe api" to get a column, which is one of the few things we already provide).
(disclaimer: I am not a matplotlib developer, I also don't know if they for example have efforts to add support for generic array-likes (but it's nonetheless a typical example use case, I think))
- Lingua principale
- Python
- Stelle
- 106
- Fork
- 22
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di data-apis/dataframe-api
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
data-apis/dataframe-api#363 · 1 commento · 8 reazioni ·
-
Row ordering design choiceApertaAPI design
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
data-apis/dataframe-api#356 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
data-apis/dataframe-api#355 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
data-apis/dataframe-api#352 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
data-apis/dataframe-api#351 ·
Tutte le issue di data-apis/dataframe-api
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
openwisp/openwisp-utils#777 ·
-
Boolean statistics (Covered, Confident, JaccardDistant) aggregate to 1.0 without float weightsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
google-research/weatherbenchX#310 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/peft#3955 ·
I maintainer di solito rispondono entro 1 giorno
-
author-page correction
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
acl-org/acl-anthology#10313 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/Gitcord-GithubDiscordBot#147 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno