Skip to content

Instantly share code, notes, and snippets.

@zgulde
Created October 11, 2019 01:49
Show Gist options
  • Save zgulde/2e27b9450e4c0a6510d06df7db32d0a5 to your computer and use it in GitHub Desktop.
Save zgulde/2e27b9450e4c0a6510d06df7db32d0a5 to your computer and use it in GitHub Desktop.
In [148]: def various_scales(s: pd.Series):
...: df = pd.DataFrame()
...: df['original'] = s
...: df['min_max'] = MinMaxScaler().fit_transform(s.values.reshape(-1, 1))
...: df['percentile'] = s.rank(pct=True)
...: df['rank'] = s.rank()
...: df['z_score'] = StandardScaler().fit_transform(s.values.reshape(-1, 1))
...: return df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment