Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Create more user friendly aliases from `col`

Aperta
#754 5 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
data

Direzione di ricerca

La issue identifica col(...) e .alias() come i punti di ingresso Python rilevanti; l'esempio mostra AVG(?table?.has_parking) come output indesiderato. Inizia individuando la loro implementazione e gli eventuali test esistenti; il lavoro è completato quando il ?table? predefinito viene rimosso, mentre gli alias espliciti come Area e Percentage of buildings with parking continuano a funzionare.

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

Descrizione

enhancement

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
This is a user enhancement request to make the python interface remove the default ?table? on columns.

Describe the solution you'd like
I have not yet reviewed the applicable code to offer a best solution yet. I'm adding this feature request to track.

Describe alternatives you've considered
User adds an .alias() command as below, which may be tedious.

Additional context
See the below example from @datapythonista that includes the desired use case

import datafusion
from datafusion import col, lit, functions as f
import pyarrow


# something like this would be implemented internally, so users can call `datafusion.read_*`
def _read_parquet(*args, **kwargs):
    ctx = datafusion.SessionContext()
    return ctx.read_parquet(*args, **kwargs)
datafusion.read_parquet = _read_parquet  # creating an alias of `read_*` functions so users don't need to know about `SessionContext` when the defaults are fine


df = (datafusion.read_parquet("buildings.parquet")
                .filter(  # `.filter()` accepting multiple conditions (which will be an AND) instead of having to use `&` with its operator precedence problems
                    col("is_offplan") == False,
                    col("rooms") >= 2,  # `.lit(2)` not being required, and Python literals working with operators
                )
                .aggregate(
                    [col("area_name_en")],
                    [f.mean(col("has_parking").cast(float))],  # `.cast()` accepting Python types, which would be internally converted to the PyArrow equivalent
                )
                .select(
                    col("area_name_en").alias("Area"),
                    col("AVG(has_parking)").alias("Percentage of buildings with parking"),  # removing the default `?table?` in column names, the column name was "AVG(?table?.has_parking)"
                )
     )
Lingua principale
Python
Stelle
605
Fork
176
Merge medio
1g 23h
PR unite (30g)
8

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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 apache/datafusion-python

Tutte le issue di apache/datafusion-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.