I find it hard to explain with words what I want to achieve, so please don't judge me for showing a simple example instead. I have a table that looks like this:
main_col | some_metadata | value |
---|---|---|
this | True | 10 |
this | False | 3 |
that | True | 50 |
that | False | 10 |
other | True | 20 |
other | False | 5 |
I want to normalize this data separately for each case of main_col
. For example, if we're to choose min-max normalization and scale it to range [0; 100], I want the output to look like this:
main_col | some_metadata | value (normalized) |
---|---|---|
this | True | 100 |
this | False | 30 |
that | True | 100 |
that | False | 20 |
other | True | 100 |
other | False | 25 |
Where for each case of main_col
, the highest value is scaled to 100 and another value is scaled in respective proportion.
this False
is-10
instead of3
the result will be-100
instead of0
. – Selda