gaspatchio-extending

Implements vectorized Polars accessor methods to extend the Gaspatchio actuarial framework.

4|Updated Jul 4, 2026
One-click install
npx skills add https://github.com/gaspatchio/gaspatchio --skill gaspatchio-extending-gaspatchio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gaspatchio-extending
Source: https://github.com/gaspatchio/gaspatchio/tree/main/skills/gaspatchio-extending
Command: npx skills add https://github.com/gaspatchio/gaspatchio --skill gaspatchio-extending-gaspatchio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires polars, gaspatchio, and includes references (resource) components.

What problem does it solve? Actuarial models often need custom calculations that do not exist in the Gaspatchio framework, and naive implementations using Python loops or map_elements run 20-1000x slower. This Skill guides you to place each calculation correctly and build vectorized accessor methods that compose Polars expressions. ## Core Features & Use Cases - Performance Ladder Decision Framework: Routes every calculation to the right home — existing methods, inline operators, setup utilities, Rust kernels, or new accessors — before any code is written. - Accessor Templates: Provides complete column and frame accessor templates with registration, scalar/list column handling, and docstring conventions. - Anti-Pattern Catalog: Documents seven slow patterns (Python loops, map_elements, dict lookups per row) with their vectorized replacements. - Use Case: You need a Gompertz hazard rate function reusable across models. The Skill confirms no existing method via uv run gspio docs, then guides you to build a registered column accessor returning an ExpressionProxy. ## Quick Start Ask the AI to add a custom calculation such as a Macaulay duration or Gompertz hazard rate method to Gaspatchio as a reusable vectorized accessor.

Frequently Asked Questions about gaspatchio-extending

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a custom calculation method to Gaspatchio?

First run uv run gspio docs to confirm the method does not exist, then use the performance ladder to place it. Reusable element-wise calculations become column accessors inheriting from BaseColumnAccessor and registered with @register_accessor.

How do I port functions from lifelib or JuliaActuary to Gaspatchio?

Port functions by reimplementing them as vectorized Polars expressions inside a column or frame accessor. Closed-form formulas like annuity factors or hazard rates map directly; Monte Carlo or per-policy sequential logic must be flagged for a Rust kernel instead.

Why is map_elements slow in Polars actuarial calculations?

map_elements converts each value to a Python object, calls a Python function, and converts back, defeating SIMD vectorization and causing 20-100x slowdowns. The correct approach composes native Polars expressions or uses when/then/otherwise for conditional logic.

Can Gaspatchio accessors handle both scalar and list columns?

Yes, accessors must handle both by reading the proxy's cached shape attribute. List columns use list.eval with pl.element() for element-wise transforms, while scalar columns use direct expression operations.

When should a calculation not become a Gaspatchio accessor?

Single-operator formulas belong inline, one-time setup calculations like curve fitting belong in Python utilities, and Monte Carlo or inner-loop-to-omega work needs a Rust kernel. Scenario stresses use the shocks composables, not accessors.