csv-wrangler
Installation
SKILL.md
CSV-Wrangler
Patterns for handling real-world messy CSV files.
Encoding Detection
import chardet
def detect_encoding(file_path: str, sample_size: int = 10000) -> str:
"""Detect file encoding from sample."""
with open(file_path, 'rb') as f:
raw = f.read(sample_size)
result = chardet.detect(raw)
return result['encoding']