Signature for a standard `from_dataframe` constructor function
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python
- Bereich
- backend-api-design
Rechercherichtung
Lies den Abschnitt to-be-decided in protocol/dataframe_protocol_summary.md, die Diskussion in issue #29 und den hier gezeigten Pandas-Prototypen. Vergleiche die vorgeschlagenen from_dataframe-Signaturen und zugehörigen Optionen und prüfe anschließend den Entwurf des Ankündigungs-Blogposts. Erledigt ist die Aufgabe, wenn das Projekt eine vereinbarte Standardsignatur und deren unterstützten Umfang dokumentiert hat.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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?
- Vorherrschende Sprache
- Python
- Sterne
- 106
- Forks
- 22
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus data-apis/dataframe-api
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
data-apis/dataframe-api#363 · 1 Kommentar · 8 Reaktionen ·
-
API design
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
data-apis/dataframe-api#356 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
data-apis/dataframe-api#355 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
data-apis/dataframe-api#352 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
data-apis/dataframe-api#351 ·
Alle Issues in data-apis/dataframe-api
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
PolicyEngine/policyengine-us#10262 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
kellyjonbrazil/jc#788 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
`/search.json` ignores the documented `editions.sort` parameterEvtl. vergeben @PranavD2905 hat das heute übernommen. OffenAffects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
internetarchive/openlibrary#13989 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug P2: misleading query
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
jeffknupp/association#478 ·