Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Create more user friendly aliases from `col`

Offen
#754 5 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
data

Rechercherichtung

Das Issue identifiziert col(...) und .alias() als die relevanten Python-Einstiegspunkte; das Beispiel zeigt AVG(?table?.has_parking) als die unerwünschte Ausgabe. Beginne damit, ihre Implementierung und alle vorhandenen Tests zu finden; fertig ist die Änderung, wenn das standardmäßige ?table? entfernt wird, während explizite Aliase wie Area und Percentage of buildings with parking weiterhin funktionieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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)"
                )
     )
Vorherrschende Sprache
Python
Sterne
605
Forks
176
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
8

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/datafusion-python

Alle Issues in apache/datafusion-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.