pandas-data-processing-5-groupby-operations
Sub-skill of pandas-data-processing: 5. GroupBy Operations.
от vamseeachanta★ 21 звезда на GitHub
Установить pandas-data-processing-5-groupby-operations в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
5. GroupBy Operations
5. GroupBy Operations
Group and Aggregate:
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:
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)
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл pandas-data-processing-5-groupby-operations?
Sub-skill of pandas-data-processing: 5. GroupBy Operations.
Как установить скилл pandas-data-processing-5-groupby-operations?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pandas-data-processing-5-groupby-operations запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…