Form the documentation of Dataset:
dataset = Dataset[{
<|"a" -> 1, "b" -> "x", "c" -> {1}|>,
<|"a" -> 2, "b" -> "y", "c" -> {2, 3}|>,
<|"a" -> 3, "b" -> "z", "c" -> {3}|>,
<|"a" -> 4, "b" -> "x", "c" -> {4, 5}|>,
<|"a" -> 5, "b" -> "y", "c" -> {5, 6, 7}|>,
<|"a" -> 6, "b" -> "z", "c" -> {}|>}]
gives a Dataset with columns "a", "b" and "c". To rename a column in a Dataset one uses the syntax
dataset[All,<|"New"->"old"|>]
where "old" is the old column name and "New" is the new one. Here (also from the documentation):
dataset[All, <|"A" -> "a", "B" -> "b", "C" -> "c"|>]
and one gets the new Dataset with columns "A", "B" and "C". I wonder why this is in this way and not:
dataset[All,<|"old"->"New"|>]
Can one give me a hint?
"old"
is implicitly#["old"]
. With that in mind,#["old"]->"New"
is not what we want;"New"->#["old"]
is. $\endgroup$