justanewb
justanewb

Reputation: 133

Get a error claiming my 2D array is not 2D in impyute

Here is the shape of my array

b = data[0].values
print(b.shape)

(5126, 4229)

I get this error when I run this code:

from impyute.imputation.cs import mice

# start the MICE training
a=mice(b)

Error:

ValueError: Expected 2D array, got 1D array instead:
array=[].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

I am confused by this error message, any recommendations?

Upvotes: 1

Views: 83

Answers (1)

Hamdi Tarek
Hamdi Tarek

Reputation: 141

First, you must change your input data to a 2D array, so you must specify the number of features in your data using reshape function.

Please try to use b.reshape(5126, 4229), if not try to follow this example until you figure out the problem

Upvotes: 1

Related Questions