Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Scaling elements of marix.
I have a matrix 682x10 and I have problem with one task. I want to do for each j-column Xj=(Xj-min(Xj))/(max(Xj)-min(Xj)). Of course, I know how to do this with for. But I have to use numpy library.I tried it this way:
X[0:] = (X[0:] - np.min(X[0:])) / (np.max(X[0:]) - np.min(X[0:]))
NotImplementedError: subtracting a nonzero scalar from a sparse matrix is not supported
Could you show example of input and output that you'd like to achieve using some random 4x2 array?

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  WaveCopy and Amplitude Scaling kgbprod 3 157 Apr-24-2019, 05:49 PM
Last Post: kgbprod
  Recursive Function - Compare 2 lists, return the elements that don't exist in both KellyBaptist 1 324 Dec-23-2018, 10:10 AM
Last Post: Gribouillis
  Printing elements in a tuple with formatting oncebuddy 1 773 Jan-24-2018, 06:25 AM
Last Post: Gribouillis
  Repeating elements when appending in iteration in Python 3.6 miguelsantana 2 787 Dec-17-2017, 01:22 AM
Last Post: Terafy
  reach the elements in the list ptah 7 1,026 Oct-04-2017, 08:12 PM
Last Post: ptah
  join elements from two splits dwiga 2 991 Sep-29-2017, 09:27 PM
Last Post: nilamo

Forum Jump:

Users browsing this thread: 1 Guest(s)