Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

jupyter-notebook-analysis

БесплатноБез исполняемых скриптовНе проверен

Best practices for creating comprehensive Jupyter notebook data analyses with statistical rigor, outlier handling, and publication-quality visualizations…

Delphine-Lот Delphine-L★ 23 звезды на GitHub

Об этом скилле

Jupyter Notebook Analysis Patterns

Expert knowledge for creating comprehensive, statistically rigorous Jupyter notebook analyses.

When to Use This Skill

  • Creating multi-cell Jupyter notebooks for data analysis
  • Adding correlation analyses with statistical testing
  • Implementing outlier removal strategies
  • Building series of related visualizations (10+ figures)
  • Analyzing large datasets with multiple characteristics
  • Building data update/enrichment notebooks with multi-source merging
  • Generating figures for sharing with Claude or other AI tools

Important: Image Size Constraints

When generating images to share with Claude, images must not exceed 8000 pixels in either dimension. Add this helper to your notebook imports:

# Standard imports with Claude size checking
import matplotlib.pyplot as plt
import seaborn as sns
from PIL import Image

MAX_CLAUDE_DIM = 7999  # Claude API limit with safety margin

def save_figure(filename, dpi=300, **kwargs):
    """Save figure with automatic Claude size constraint check."""
    plt.savefig(filename, dpi=dpi, bbox_inches='tight', **kwargs)

    # Verify and auto-resize if needed
    img = Image.open(filename)
    if img.width > MAX_CLAUDE_DIM or img.height > MAX_CLAUDE_DIM:
        print(f"Auto-resizing {filename} for Claude compatibility")
        print(f"   Original: {img.width}x{img.height}")
        img.thumbnail((MAX_CLAUDE_DIM, MAX_CLAUDE_DIM), Image.Resampling.LANCZOS)
        img.save(filename)
        print(f"   Resized: {img.width}x{img.height}")
    else:
        print(f"OK {filename}: {img.width}x{img.height}")

# Safe figure sizes for Claude (300 DPI)
FIG_SIZES = {
    'small': (7, 5),       # 2100x1500 px
    'medium': (12, 9),     # 3600x2700 px
    'large': (20, 15),     # 6000x4500 px
    'max': (26, 26),       # 7800x7800 px - maximum safe
}

# Use in notebook
fig, ax = plt.subplots(figsize=FIG_SIZES['medium'])
# ... plotting code ...
save_figure('figure.png')

For complete image size guidance, see the data-visualization skill.

Core Notebook Patterns

Data Update/Enrichment Notebooks

Use structured notebook patterns for multi-source data merging and enrichment. Key principles:

  1. Configuration section at top with safety defaults (ENABLE_AWS_FETCH = False, TEST_MODE = True)
  2. Composite keys for complex merge uniqueness requirements
  3. Conflict resolution with configurable strategy (NEW vs OLD priority)
  4. Idempotent column addition -- check if columns exist before adding
  5. Enrichment tracking -- count what was actually saved, not just fetched
  6. Two-stage file workflow -- input file -> distinct output file (never in-place)

For detailed patterns including data update, enrichment, and AWS GenomeArk workflows, see notebook-patterns.md.

Notebook Editing

Always use NotebookEdit tool for .ipynb file modifications -- never the Edit tool (corrupts JSON structure).

Three modes: replace (update cell content), insert (add new cell after target), delete (remove cell).

Key rules:

  • Always specify cell_type when inserting
  • Find cell IDs with jq or Python JSON parsing
  • After programmatic edits, instruct user to "Restart & Run All"
  • Update in dependency order when changing metrics across cells

For NotebookEdit usage, programmatic JSON manipulation, bulk operations, and cell newline handling, see notebook-editing.md.

Statistical Methods

Required for All Correlation Analyses

  1. Pearson correlation with p-values using scipy.stats.pearsonr
  2. Report r, p-value, and n on every correlation plot
  3. Mann-Whitney U test for group comparisons

Outlier Handling

  • Stage 1: Count-based outliers (IQR method) -- remove before analysis
  • Stage 2: Value-based outliers (percentile) -- apply only to visualization, not statistics
  • Apply characteristic-specific outlier removal separately per analysis
  • Always report number of outliers removed

Statistical Claim Verification (CRITICAL)

BEFORE finalizing any analysis notebook, verify ALL statistical claims against actual computed values. Text claims can become stale after data/code updates. Extract claims, rerun tests, create verification table.

For detailed statistical methods, outlier removal code, claim verification workflow, and confounding analysis, see statistical-methods.md.

Publication-Quality Figures

Key Standards

  • DPI: 300 for publication, 150 for digital viewing
  • Font sizes: Title 18pt bold, axis labels 16pt bold, ticks 14pt, legend 12pt
  • Colors: Use colorblind-safe palettes (IBM/Okabe-Ito). Blue #0173B2 + Orange #DE8F05 for two-group comparisons
  • Data imbalance: Add prominent warnings when sample size ratio > 5x

Image Display

  • Use HTML <img> tags in markdown cells for responsive SVG/PNG scaling
  • Crop SVGs by modifying viewBox attributes directly (
Полный SKILL.md на GitHub

Установить jupyter-notebook-analysis в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Bash

Вложенные файлы

notebook-editing.mdnotebook-organization.mdnotebook-patterns.mdsharing-and-export.mdstatistical-methods.mdtroubleshooting.mdvisualization-guide.md

FAQ

Что делает скилл jupyter-notebook-analysis?

Best practices for creating comprehensive Jupyter notebook data analyses with statistical rigor, outlier handling, and publication-quality visualizations. Includes Claude API image size helpers.

Как установить скилл jupyter-notebook-analysis?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл jupyter-notebook-analysis запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить jupyter-notebook-analysis с