Skip to content

Expected 2D array, got 1D array instead #16

@guireif

Description

@guireif

Hi,

I'm getting the following error when I run the following cell
What should I do?

scaler = MinMaxScaler(feature_range=(-1, 1)) train_sc = scaler.fit_transform(train) test_sc = scaler.transform(test)

Expected 2D array, got 1D array instead: array=[17.24 18.190001 19.219999 ... 10.47 10.18 11.04 ]. Reshape your data either using array.reshape(-1, 1)

Activity

taufique1929

taufique1929 commented on Apr 12, 2019

@taufique1929

scaler = MinMaxScaler(feature_range=(-1,1))
train = np.asarray(train).reshape(-1,1)
test = np.asarray(test).reshape(-1,1)
train_sc = scaler.fit_transform(train)
test_sc = scaler.transform(test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @taufique1929@guireif

        Issue actions

          Expected 2D array, got 1D array instead · Issue #16 · susanli2016/Machine-Learning-with-Python