close

[Solved] ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler Error Occurs?

Today I get the following error ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler in python.

How To Solve ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler Error ?

  1. How To Solve ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler Error ?

    To Solve ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler Error I know that this post is old, but as I stumbled here, others will.. After running in the same problem and googling quite a bit I found a post 

  2. ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler

    To Solve ValueError: Found array with 0 sample (s) (shape= (0, 1) while a minimum of 1 is required by MinMaxScaler Error I know that this post is old, but as I stumbled here, others will.. After running in the same problem and googling quite a bit I found a post 

Solution 1

The train_data variable has a length of 2264:

train_data = stock_value[:2264]

Then, when you go to fit the scaler, you go outside of train_data‘s bounds on the third iteration of the for loop:

smoothing_window_size = 1100
for di in range(0, 4400, smoothing_window_size):

Notice the size of the data set in the tutorial. The training and testing chunks each have length 11,000, and the smoothing_window_size is 2500, so it will never go exceed train_data‘s boundaries.

Solution 2

I know that this post is old, but as I stumbled here, others will.. After running in the same problem and googling quite a bit I found a post 

so it seems that if you download a too small dataset it will throw that error. Download a .csv from 1962 and it’ll be big enough ;).

Now,I just have to find the right parameters for my dataset..as I’m adapting this to another type o prediction.. Hope it helps

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read