# KeyError: "['column_name'] not in index"

- **ID:** `python/pandas-keyerror-column`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Referenced column does not exist in the DataFrame, often due to whitespace, case, or rename operations.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   print(df.columns.tolist()) and normalize with df.columns = df.columns.str.strip()
   ```
2. **** (90% success)
   ```
   cols = [c for c in wanted if c in df.columns]; df[cols]
   ```

## Dead Ends

- **** — Still raises KeyError if column truly missing (85% fail)
- **** — Silently produces empty results downstream (70% fail)
