agentleFS
atsushi-greenatsushi-green/ds-ai-coding-skills/.claude/skills/dataframe-polars/SKILL.md

dataframe-polars

Skill86 starsChanged 52 days agoMITView on GitHub

Use this when performing DataFrame operations — including loading, filtering, joining, aggregating, transforming, or reshaping tabular data with polars or pandas.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for DataFrame operations.

    line 8
  2. Distinctive:

    Prefer polars for all DataFrame work.

    line 12
  3. Distinctive:

    Prefer LazyFrame for loading, filtering, joins, aggregations, and transformations.

    line 13
  4. Distinctive:

    Use eager execution when simpler and data is small.

    line 14
  5. Distinctive:

    Use pandas only when required by an existing dependency, external library, or legacy code.

    line 18
  6. Distinctive:

    If pandas is needed, keep its usage minimal and convert back to polars as soon as practical.

    line 19
  7. Distinctive:

    Avoid manual, spreadsheet-like edits.

    line 24
  8. Distinctive:

    Document data transformations with comments (in Japanese).

    line 25

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: DataFrame Operations with Polars

Use this skill for DataFrame operations.

Default: Polars

  • Prefer polars for all DataFrame work.
  • Prefer LazyFrame for loading, filtering, joins, aggregations, and transformations.
  • Use eager execution when simpler and data is small.

Pandas: Only When Required

  • Use pandas only when required by an existing dependency, external library, or legacy code.
  • If pandas is needed, keep its usage minimal and convert back to polars as soon as practical.

Transformations

  • Transformations should be reproducible and scriptable.
  • Avoid manual, spreadsheet-like edits.
  • Document data transformations with comments (in Japanese).

Examples

Lazy Scan and Filter

import polars as pl

# Parquetファイルを遅延読み込み
lf = pl.scan_parquet("data/raw/events.parquet")

# 日付フィルタと列選択
result = (
    lf.filter(pl.col("event_date") >= "2024-01-01")
    .select(["user_id", "event_type", "event_date"])
    .collect()
)

Group By and Aggregation

# ユーザーごとのイベント数を集計
summary = (
    lf.group_by("user_id")
    .agg(
        pl.col("event_type").count().alias("event_count"),
        pl.col("event_date").max().alias("last_event"),
    )
    .collect()
)

Safe Join with Row Count Check

left = pl.scan_parquet("data/processed/users.parquet")
right = pl.scan_parquet("data/processed/orders.parquet")

# 結合前の行数を確認
left_count = left.select(pl.len()).collect().item()
right_count = right.select(pl.len()).collect().item()

joined = left.join(right, on="user_id", how="left").collect()

# 結合後の行数を確認(ファンアウトの検出)
assert joined.height >= left_count, "LEFT JOINで行が減少:joinキーを確認"
print(f"left={left_count}, right={right_count}, joined={joined.height}")

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.