Created
January 5, 2018 21:36
-
-
Save jaradc/df5aefb64cb911beaa53f9efc8c75611 to your computer and use it in GitHub Desktop.
This function scales a numpy array between two values (ex: 0.05, 1.25)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def scale_between(series, min_amt, max_amt): | |
series_min = series.min() | |
series_max = series.max() | |
return (((max_amt - min_amt)*(series - series_min)) / (series_max - series_min)) + min_amt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment