Skip to content

Conversation

Copy link

Copilot AI commented Dec 5, 2025

New example showcasing fundamental Daft data transformation patterns for newcomers.

Changes

  • New example: usage_patterns/data_transformations/explore_filter_aggregate.py

    • Schema exploration, filtering, column transformations with when/otherwise, groupby aggregations, sorting
    • Self-contained sample emotion dataset (no external dependencies)
    • Contributor: GitHub Copilot
  • README: Added Data Transformations section

Example usage

from daft import col
from daft.functions import when

df_transformed = (
    df
    .with_column("text_length", col("text").str.length())
    .with_column("word_count", col("text").str.split(" ").list.length())
    .with_column(
        "label_name",
        when(col("label") == 0, "sadness")
        .when(col("label") == 1, "joy")
        .otherwise("other")
    )
)

stats = (
    df_transformed
    .groupby("label_name")
    .agg(
        col("text").count().alias("count"),
        col("text_length").mean().alias("avg_length"),
    )
)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)
  • daft.gateway.scarf.sh
    • Triggering command: /usr/bin/python python usage_patterns/data_transformations/explore_filter_aggregate.py (dns block)
    • Triggering command: /usr/bin/python python -c import daft; from daft import col; df = daft.from_pydict({'text': ['hello', 'world']}); help(col('text').str) (dns block)
    • Triggering command: /usr/bin/python python -c import daft; from daft import col; df = daft.from_pydict({'text': ['hello', 'world']}); print(df.with_column('len', col('text').str.length()).collect()) (dns block)
  • huggingface.co
    • Triggering command: /usr/bin/python python usage_patterns/data_transformations/explore_filter_aggregate.py (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I want you build me a new example from scratch. Include yourself as the contributor. Welcome to the team.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 5, 2025 07:44
…ations

Co-authored-by: everettVT <145285237+everettVT@users.noreply.github.com>
Co-authored-by: everettVT <145285237+everettVT@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new example from scratch Add data transformations example demonstrating core Daft operations Dec 5, 2025
Copilot AI requested a review from everettVT December 5, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants