I often have a list of pairs, as
data = {{0,0.0},{1,12.4},{2,14.6},{3,25.1}}
and I want to do something, for instance Rescale
, to al
How about
Transpose[{#[[All, 1]], Rescale[#[[All, 2]]]} &@data]
which returns what you want (ie, it does not alter data
)
If no Transpose
is allowed,
Thread[Join[{#[[All, 1]], Rescale[#[[All, 2]]]} &@data]]
works.
EDIT: As "shortest" is now the goal, best from me so far is:
data\[LeftDoubleBracket]All, 2\[RightDoubleBracket] = Rescale[data[[All, 2]]]
at 80 characters, which is identical to Mr.Wizard's... So vote for his answer.