How to calculate percentage between the range of two values a third value is

后端 未结 4 694
忘掉有多难
忘掉有多难 2021-01-30 00:40

Example:

I\'m trying to figure out the calculation for finding the percentage between two values that a third value is.

Example: The range is 46 to 195. The va

4条回答
  •  广开言路
    2021-01-30 01:35

    Can be used for scaling any number of variables

    Python Implementation:

    # List1 will contain all the variables
    list1 = []
    # append all the variables in list1
    list1.append(var1)
    list1.append(var2)
    list1.append(var3)
    list1.append(var4)
    
    
    # Sorting the list in ascending order
    list1.sort(key = None, reverse = False)
    
    # Normalizing each variable using ( X_Normalized = (X - X_minimum) / (X_Maximum - X_minimum)  )
    normalized_var1 = (var1 - list1[0]) / (list1[-1] - list1[0])
    normalized_var2 = (var2 - list1[0]) / (list1[-1] - list1[0])
    normalized_var3 = (var3 - list1[0]) / (list1[-1] - list1[0])
    normalized_var4 = (var4 - list1[0]) / (list1[-1] - list1[0])
    

提交回复
热议问题