pandas-data-processing-5-groupby-operations
Sub-skill of pandas-data-processing: 5. GroupBy Operations.
Best use case
pandas-data-processing-5-groupby-operations is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of pandas-data-processing: 5. GroupBy Operations.
Teams using pandas-data-processing-5-groupby-operations should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/5-groupby-operations/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pandas-data-processing-5-groupby-operations Compares
| Feature / Agent | pandas-data-processing-5-groupby-operations | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of pandas-data-processing: 5. GroupBy Operations.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 5. GroupBy Operations
## 5. GroupBy Operations
**Group and Aggregate:**
```python
def group_by_sea_state(
df: pd.DataFrame,
hs_column: str = 'Hs',
tp_column: str = 'Tp',
hs_bins: list = None,
tp_bins: list = None
) -> pd.DataFrame:
"""
Group results by sea state (Hs, Tp bins).
Args:
df: Input DataFrame with sea state parameters
hs_column: Column name for significant wave height
tp_column: Column name for peak period
hs_bins: Bins for Hs [0, 2, 4, 6, 8, 10]
tp_bins: Bins for Tp [0, 6, 8, 10, 12, 14]
Returns:
Grouped statistics by sea state
"""
if hs_bins is None:
hs_bins = [0, 2, 4, 6, 8, 10, 12]
if tp_bins is None:
tp_bins = [0, 6, 8, 10, 12, 14, 16]
# Create bins
df['Hs_bin'] = pd.cut(df[hs_column], bins=hs_bins)
df['Tp_bin'] = pd.cut(df[tp_column], bins=tp_bins)
# Group and aggregate
grouped = df.groupby(['Hs_bin', 'Tp_bin']).agg({
'Tension_Max': ['mean', 'std', 'max'],
'Motion_Max': ['mean', 'std', 'max'],
'Offset_Max': ['mean', 'std', 'max']
})
return grouped
# Example
sea_state_results = pd.DataFrame({
'Hs': [2.5, 3.0, 4.5, 5.0, 6.5, 7.0],
'Tp': [7.0, 8.5, 9.0, 10.5, 11.0, 12.5],
'Tension_Max': [1500, 1600, 1800, 2000, 2200, 2400],
'Motion_Max': [2.0, 2.5, 3.0, 3.5, 4.0, 4.5],
'Offset_Max': [50, 60, 70, 80, 90, 100]
})
grouped_stats = group_by_sea_state(sea_state_results)
print(grouped_stats)
```
**Multi-Level Grouping:**
```python
def analyze_by_loadcase_and_direction(
df: pd.DataFrame,
group_columns: list = ['LoadCase', 'Direction'],
value_columns: list = None
) -> pd.DataFrame:
"""
Analyze results grouped by load case and direction.
Args:
df: Input DataFrame
group_columns: Columns to group by
value_columns: Columns to aggregate (None = all numeric)
Returns:
Multi-level grouped statistics
"""
if value_columns is None:
value_columns = df.select_dtypes(include=[np.number]).columns.tolist()
# Group and calculate statistics
grouped = df.groupby(group_columns)[value_columns].agg([
'count', 'mean', 'std', 'min', 'max'
])
return grouped
# Example
load_case_data = pd.DataFrame({
'LoadCase': ['Operating', 'Operating', 'Storm', 'Storm', 'Extreme', 'Extreme'],
'Direction': [0, 45, 0, 45, 0, 45],
'Tension': [1500, 1520, 2000, 2050, 2500, 2600],
'Offset': [50, 55, 75, 80, 100, 110]
})
stats_by_case = analyze_by_loadcase_and_direction(load_case_data)
print(stats_by_case)
```Related Skills
data-validation-reporter
Generate interactive validation reports with quality scoring, missing data analysis, and type checking. Combines Pandas validation, Plotly visualization, and YAML configuration for comprehensive data quality reporting.
memory-bridge-operations
Operate and recover the Hermes-to-repo memory bridge: drift checks, quality gate, bridge commits, push verification, and stash recovery when pre-bridge scripts fail after generating outputs.
worldenergydata-source-readiness
Route agents to the canonical worldenergydata source-readiness skill and summary script. Use when asked for worldenergydata data completeness, data locations, latest known data dates, scheduler freshness, source-readiness status, or acceptance-criteria inputs across the repo ecosystem.
sodir-data-extractor
Extract and process Norwegian Petroleum Directorate field and production data from SODIR
metocean-data-fetcher
Fetch real-time and historical metocean data from NDBC, CO-OPS, Open-Meteo, ERDDAP, and MET Norway. Use for buoy data retrieval, tidal observations, marine forecasts, and multi-source data fusion.
energy-data-visualizer
Interactive visualization for oil and gas production data analysis using Plotly dashboards
bsee-data-extractor
Extract and process BSEE (Bureau of Safety and Environmental Enforcement) data including production, WAR (Well Activity Reports), and APD (Application for Permit to Drill) data. Use for querying production data, well activities, drilling permits, completions, and workovers by API number, block, lease, or field with automatic data normalization and caching.
tax-return-data-capture-and-archival
Capture structured tax return summaries as YAML for year-over-year comparison, with fallback to manual PDF download and relocation when automation fails
repo-separation-for-sensitive-data
Architecture pattern for splitting confidential data and reusable algorithms across repos
metadata-only-wiki-sweep-workflow
Disciplined inventory process for cataloging documents by filename/path without content claims, using parent-centric grouping to prevent stub proliferation
metadata-only-inventory-sweep
Execute constrained file inventory sweeps with metadata-only stubs and validation, useful for staged documentation work on large file sets
handle-blocked-financial-sites-data-export
Workflow for extracting data from blocked financial sites when browser automation is restricted