Home > Software engineering >  Applying math formule to Pandas Series elements
Applying math formule to Pandas Series elements

Time:05-10

Variables data, maxs and mins are Pandas Series with the same indexes.

I want to match the elements of the three variables by indexes.

How can I apply this function properly ?

def denormalize(data, maxs, mins):
    return (maxs - data) / (maxs - mins)

CodePudding user response:

IIUC:

The results of the formula are wrong.

def denormalize(data, maxs, mins):
    return (mins - maxs) * data   maxs

This is the reverse formula of normalize: (maxs - data) / (maxs - mins)

  • Related