Search code examples
pythontransformrescale

Python Rescale/Transform data


I need to rescale data from a specific range (-120, 14870) to (0, 512). I've been trying different methods but not one seems to be succesful, any ideas how can i get it done?

Thanks in advance


Solution

  • You can use feature scaling and in particular min-max normalization:

    (x - x.min) / (x.max - x.min) * 512