# sklearn.exceptions.NotFittedError: This StandardScaler instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.

- **ID:** `python/sklearn-notfitted-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Calling transform/predict on an estimator before fit, or using a fresh estimator inside a pipeline instead of the fitted one.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   scaler = StandardScaler().fit(X_train); X_test_s = scaler.transform(X_test)
   ```
2. **** (95% success)
   ```
   Wrap in Pipeline([('scaler', StandardScaler()), ('clf', LogisticRegression())]) so fit handles all steps
   ```

## Dead Ends

- **** — Same error, no fitted state (90% fail)
- **** — StandardScaler supports partial_fit but requires correct usage; often yields wrong stats (60% fail)
