Normalize numpy ndarray data

Viewed 3597

My data is numpy ndarray with shape(2,3,4) following this: I've try to normalize 0-1 scale for each column through sklearn normalization.

from sklearn.preprocessing import normalize  

x = np.array([[[1, 2, 3, 4],
      [2, 2, 3, 4],
      [3, 2, 3, 4]],
      [[4, 2, 3, 4],
      [5, 2, 3, 4],
      [6, 2, 3, 4]]])

x.shape ==> ( 2,3,4) 

x = normalize(x, norm='max', axis=0, ) 

However, I catch the error :

ValueError: Found array with dim 3. the normalize function expected <= 2.

How do I solve this problem?

Thank you.

1 Answers
Related