Python Forum

Full Version: How to get array fit/transform to be correct?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to fit/transform a (1,2) ndarray, but I keep getting zeros instead of transformed values.

sc = StandardScaler()
test_data = np.array([[48], [290000]]).reshape(1,2)  # also tried this...
# print the data fit transformation --> prints array of zeros!
test_data=sc.fit_transform(test_data)
print(test_data)  # prints: [[    48 290000]]
print (sc.fit_transform(test_data)))  # prints [[0. 0.]  <--- PROBLEM!
So, I've tried a regular array, an np array, etc., but no matter what try, my "transformed" array is [0., 0.].

Any suggestions on what I need to do to correctly scale an array like above?

Thanks very much in advance,

Oliver