Analytics 스킬
모든 데이터셋과 함께 작동하는 유연한 데이터 과학 분석 도구입니다. 스키마를 자동으로 탐지하고, 시각화를 추천하며, create-figure 형식으로 내보낼 수 있습니다.
빠른 시작 (모든 데이터셋)
cd .pi/skills/analytics
./run.sh describe data.jsonl
./run.sh chart data.jsonl --name distribution_channel -o chart.json
cd .agent/skills/create-figure
./run.sh metrics -i /path/to/chart.json --type bar -o chart.pdf
원활한 파이프라인
모든 데이터 (JSONL/JSON/CSV)
│
▼
┌─────────────────────────────────┐
│ analytics describe │ ← 스키마 탐지, 차트 추천
│ "5 범주형, 2 수치형, │
│ 1 시간형 컬럼 감지" │
│ 추천: │
│ - distribution_channel (막대) │
│ - trend_by_date (선) │
│ - heatmap_hour_x_day │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ analytics chart/group-by │ ← create-figure 형식의 차트 데이터 생성
│ --name distribution_channel │
│ -o chart.json │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ create-figure metrics │ ← 출판 품질의 PDF/PNG 렌더링
│ -i chart.json --type bar │
│ -o channel_distribution.pdf │
└─────────────────────────────────┘
명령어
탐색 (여기서 시작)
| 명령어 | 설명 |
|---|
describe <file> | 스키마 탐지, 컬럼 유형 감지, 차트 추천 |
./run.sh describe sales.jsonl
유연한 분석
| 명령어 | 설명 |
|---|
group-by <file> | 집계와 함께 모든 컬럼으로 그룹화 |
stats <file> | 수치 통계 및 상관관계 |
chart <file> | create-figure용 차트 스펙 생성 |
./run.sh group-by data.jsonl --by channel --for-figure -o by_channel.json
./run.sh group-by data.jsonl --by category --agg price --func sum
./run.sh stats data.jsonl --columns revenue,cost,profit
./run.sh chart data.jsonl --name distribution_channel -o chart.json
타임스탬프 데이터 (ingest-* 출력)
| 명령어 | 설명 |
|---|
insights <file> | 전체 분석 요약 (트렌드, 세션, 패턴) |
trends <file> | 이동 평균을 포함한 시청 트렌드 |
sessions <file> | 세션 감지 및 몰입 분석 |
time-patterns <file> | 시간/요일 분포 |
evolution <file> | 시간에 따른 선호도 변화 |
출력
| 명령어 | 설명 |
|---|
export <file> | 모든 표준 차트 일괄 내보내기 |
report <file> | Horus 스타일 서술형 보고서 |
지원 형식
| 형식 | 확장자 | 자동 감지 |
|---|
| JSONL | .jsonl | 줄 단위 JSON |
| JSON | .json | 배열 또는 {data: [...]} |
| CSV | .csv | 쉼표로 구분된 데이터 |
컬럼 유형 감지
describe 명령어가 자동 감지합니다:
| 유형 | 감지 로직 | 추천 차트 |
|---|
| temporal | datetime64, 날짜와 유사한 문자열 | 선, 영역, 히트맵 (시간 축) |
| numerical | int64, float64 | 히스토그램, 산점도, 통계 |
| categorical | 낮은 카디널리티 (≤20 고유값) | 막대, 파이, 히트맵 |
| boolean | bool dtype | 파이 (참/거짓) |
| text | 높은 카디널리티 문자열 | 워드 클라우드, 상위-N |
차트 추천
컬럼 유형에 기반하여 analytics가 추천합니다:
| 데이터 패턴 | 차트 유형 | create-figure 명령어 |
|---|
| 1 범주형 | 막대, 파이 | metrics --type bar |
| 1 시간형 | 선 | training-curves |
| 2 범주형 | 히트맵 | heatmap |
| 시간형 + 범주형 | 히트맵 | heatmap |
| 2+ 수치형 | 상관관계 매트릭스 | heatmap |
| 1 수치형 | 히스토그램 | metrics --type bar |
에이전트 워크플로우
프로젝트 에이전트가 모든 데이터셋을 분석하고 시각화하는 방법:
result = run("./run.sh describe data.jsonl --json")
recommendations = result["recommendations"]
chart_name = recommendations[0]["name"]
cmd = recommendations[0]["create_figure_cmd"]
run(f"./run.sh chart data.jsonl --name {chart_name} -o chart.json")
run(f"cd .agent/skills/create-figure && ./run.sh {cmd} -i chart.json -o chart.pdf")
예제
전자상거래 판매 데이터
./run.sh describe orders.jsonl
./run.sh group-by orders.jsonl --by category --agg amount --func sum --for-figure -o revenue_by_category.json
cd .agent/skills/create-figure
./run.sh metrics -i revenue_by_category.json --type bar -o revenue.pdf
YouTube 기록 (ingest-yt-history)
./run.sh insights ~/.pi/ingest-yt-history/history.jsonl
./run.sh export ~/.pi/ingest-yt-history/history.jsonl -o ./charts --for-figure
cd .agent/skills/create-figure
./run.sh heatmap -i charts/heatmap.json -o viewing_heatmap.pdf
API 응답 데이터
./run.sh describe api_logs.json
./run.sh stats api_logs.json --columns response_time
./run.sh group-by api_logs.json --by endpoint --agg response_time --func mean --for-figure -o latency.json
의존성
dependencies = [
"pandas>=2.0.0",
"typer>=0.9.0",
"rich>=13.0.0",
]
Horus와 통합
./run.sh insights ~/.pi/ingest-yt-history/history.jsonl --horus
흔한 실수
./run.sh stats data.jsonl --columns revenue,cost
./run.sh describe data.jsonl
./run.sh group-by data.jsonl --by date --agg views | ./run.sh metrics --type pie