GFQL: unify engine-specific empty-frame / row-slice idioms behind engine-agnostic helpers

Aperta
#2,270 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
pandas, python
Ambito
backend

Direzione di ricerca

Start in graphistry/compute/dataframe_utils.py, where the proposed empty_rows and row_slice helpers would live, then grep graphistry/compute for iloc[0:0], head(0) and slice(0, 0) to list the call sites. Replace the sites that can receive Polars, cuDF or polars-gpu frames so the engine branch lives only in the helpers. Done means the helpers have unit tests across pandas, Polars eager and lazy, cuDF and polars-gpu, and no remaining iloc call on those paths. Check with the maintainers which sites the fix-forward PR for #2253, #2263 and #2268 already covers before editing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement gfql p2

Summary

graphistry/compute builds empty frames and row slices with engine-specific branches, and the patterns are inconsistent. On master 4d627b23 there are 34 uses of iloc[0:0], 10 of .head(0), and 3 explicit head(0) if <polars> else iloc[0:0] branches. iloc doesn't exist on Polars frames, so any iloc[0:0] on a path that can carry Polars data is a latent crash. The master 'DataFrame' object has no attribute 'iloc' crash in #2267 was one of these.

.head(0) behaves the same on pandas (columns, dtypes, index dtype and name, frame type), on Polars eager (schema), on Polars lazy (schema; stays a LazyFrame), and on Series. It also exists on cuDF.

Ask

  • Add engine-agnostic helpers in graphistry/compute/dataframe_utils.py, e.g. empty_rows(df) (df.head(0)) and row_slice(df, start, n) (Polars slice, otherwise iloc + reset_index(drop=True)). Keep the engine branch in exactly one place.
  • Replace the scattered iloc[0:0] / head(0) if … / slice(0, 0) sites on paths that can carry Polars, cuDF, or polars-gpu frames. Pure-pandas paths can stay as they are, with a short note.
  • Unit-test the helpers on pandas, Polars eager/lazy, cuDF, and polars-gpu.

The sites touched by the recent GFQL fixes (#2253, #2263, #2268) are handled in their fix-forward PR. This issue tracks the rest of the repo.

Lingua principale
Python
Stelle
2.6k
Fork
229
Merge medio
1g 5h
PR unite (30g)
99

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di graphistry/pygraphistry

Tutte le issue di graphistry/pygraphistry

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.