Signature for a standard `from_dataframe` constructor function
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- backend-api-design
Piste de recherche
Lisez la section to-be-decided de protocol/dataframe_protocol_summary.md, la discussion dans issue #29 et le prototype Pandas présenté ici. Comparez les signatures from_dataframe proposées et les options associées, puis examinez le brouillon de l’article de blog d’annonce. La tâche est terminée lorsque le projet a consigné une signature standard approuvée et son périmètre pris en charge.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
One of the "to be decided" items at https://github.com/data-apis/dataframe-api/blob/dataframe-interchange-protocol/protocol/dataframe_protocol_summary.md#to-be-decided is:
Should there be a standard from_dataframe constructor function? This isn't completely necessary, however it's expected that a full dataframe API standard will have such a function. The array API standard also has such a function, namely from_dlpack. Adding at least a recommendation on syntax for this function would make sense, e.g., from_dataframe(df, stream=None). Discussion at https://github.com/data-apis/dataframe-api/issues/29#issuecomment-685903651 is relevant.
In the announcement blog post draft I tentatively answered that with "yes", and added an example. The question is what the desired signature should be. The Pandas prototype currently has the most basic signature one can think of:
def from_dataframe(df : DataFrameObject) -> pd.DataFrame:
"""
Construct a pandas DataFrame from ``df`` if it supports ``__dataframe__``
"""
if isinstance(df, pd.DataFrame):
return df
if not hasattr(df, '__dataframe__'):
raise ValueError("`df` does not support __dataframe__")
return _from_dataframe(df.__dataframe__())
The above just takes any dataframe supporting the protocol, and turns the whole things in the "library-native" dataframe. Now of course, it's possible to add functionality to it, to extract only a subset of the data. Most obviously, named columns:
def from_dataframe(df : DataFrameObject, *, colnames : Optional[Iterable[str]]= None) -> pd.DataFrame:
Other things we may or may not want to support:
- columns by index
- get a subset of chunks
My personal feeling is:
- columns by index: maybe, and if we do then with a separate keyword like
col_indices=None - a subset of chunks: probably not. This is more advanced usage, and if one needs it it's likely one wants to get the object returned by
__dataframe__first, then inspect some metadata, and only then decide what chunks to get.
Thoughts?
- Langage dominant
- Python
- Étoiles
- 106
- Forks
- 22
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de data-apis/dataframe-api
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#363 · 1 commentaire · 8 réactions ·
-
Row ordering design choiceOuverteAPI design
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#356 · 1 commentaire ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
data-apis/dataframe-api#355 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#352 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#351 ·
Toutes les issues de data-apis/dataframe-api
Issues similaires
-
docs: the dev-setup table and AGENTS.md name the reviewed_by guard that CI's Changelog job runsOuvertearea: tools documentation good first issue ready for a contributor
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
eyalgolan/statecraft-israel#873 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Add cover art to song rowsOuverteenhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 5 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour