Python Forum
Scaling elements of marix.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scaling elements of marix.
#1
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:]))
But:
Error:
NotImplementedError: subtracting a nonzero scalar from a sparse matrix is not supported
Reply
#2
Could you show example of input and output that you'd like to achieve using some random 4x2 array?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  quiver plot scaling help StillAnotherDave 1 1,699 Oct-26-2020, 09:17 AM
Last Post: StillAnotherDave
  Scaling random numbers within specific range schniefen 4 3,135 Oct-28-2019, 11:22 AM
Last Post: jefsummers
  WaveCopy and Amplitude Scaling kgbprod 3 3,384 Apr-24-2019, 05:49 PM
Last Post: kgbprod

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020