0 votes
1 view
in Data Science by (17.6k points)

I have the following numpy array:

from sklearn.decomposition import PCA

from sklearn.preprocessing import normalize

import numpy as np

# Tracking 4 associate metrics

# Open TA's, Open SR's, Open SE's

associateMetrics = np.array([[111,  28,  21],

   [ 27,  17,  20],

   [ 79,  23,  17],

   [185, 125,  50],

   [155,  76,  32],

   [ 82,  24,  17],

   [127,  63,  33],

   [193,  91,  63],

   [107,  24,  17]])

Now, I want to normalize every 'column' so that the values are between 0 and 1. What I mean is that the values in the 1st column for example should be between 0 and 1.

How do i do this?

normed_matrix = normalize(associateMetrics, axis=1, norm='l1')

the above gives me rowwise normalization

1 Answer

0 votes
by (33.1k points)

You can do column-wise normalization by doing this:

normalized_metrics = normalize(associateMetrics, axis=0, norm='l1'

If you wish to know about Python then visit this Python Course.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...