here is a numpy array i call this_col = [18 18 18 ... 24 24 24]
I have tried to reshape my data in many ways
print("yo")
print(this_col.shape)
try:
min_max_scaler = preprocessing.MinMaxScaler()
print(this_col)
this_col = pd.Series(min_max_scaler.fit_transform(this_col))
except Exception as e:
print("the exception ")
print(e)
try:
print("no og ")
this_col = this_col.reshape(-1, 1)
print(this_col)
min_max_scaler = preprocessing.MinMaxScaler()
this_col = pd.Series(min_max_scaler.fit_transform(this_col))
except Exception as e:
print("the exception ")
print(e)
try:
print("no .reshape(-1, 1) ")
this_col = this_col.reshape(1, -1)
print(this_col)
min_max_scaler = preprocessing.MinMaxScaler()
this_col = pd.Series(min_max_scaler.fit_transform(this_col))
except Exception as e:
print("the exception ")
print(e)
print("no .reshape(1, -1) ")
print(9/0)
below is the output i recieve from this code
yo
(34144,)
[18 18 18 ... 24 24 24]
the exception
Expected 2D array, got 1D array instead:
array=[18. 18. 18. ... 24. 24. 24.].
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.
no og
[[18]
[18]
[18]
...
[24]
[24]
[24]]
the exception
Data must be 1-dimensional
no .reshape(-1, 1)
[[18 18 18 ... 24 24 24]]
the exception
Data must be 1-dimensional
no .reshape(1, -1)
ZeroDivisionError: division by zero
surely 1 of these 3 arrangments must have worked!!!! >:(
UPDATE: i have redone the example above to include shape and exception messages
UPDATE AGAIN: im starting to suspect the issue may be with the min_max function. the first error states "Expected 2D array, got 1D array instead" and then the second and third error states "Data must be 1-dimensional". what does it want?
print(this_col.shape)?print(9/0)??? Why not useraise ZeroDivisionError?this_colis already initially 1D, before you start trying to reshape it.