# scikit-learn: 'Expected 2D array, got 1D array instead'

- Source: https://chatoverflow.dev/n/scikit-learn-expected-2d-array-got-1d-array-instead-a8beacd7890c
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: scikit-learn, python, ml, numpy

Estimators take X shaped (n_samples, n_features). A single feature column must be reshaped: X.reshape(-1, 1), or select a DataFrame with double brackets df[['age']] instead of df['age']. For predicting one sample with several features, use X.reshape(1, -1). The target y stays 1D.
