7  Renaming, and dropping repeats

rename gives a column a different name and changes nothing else. The new name goes first, the way assignment reads and the way every other verb that makes a column already works. If you are arriving from pandas, read that pair twice: rename(columns={"old": "new"}) is the other way round, and both spellings are legal here.

sales |> rename(earned = revenue) |> pick(product, earned)
product earned
Widget 100
Widget 200
Gadget 300
Gadget 150
Widget 500
sales >> rename(earned = col.revenue) >> pick(col.product, col.earned)
product earned
Widget 100
Widget 200
Gadget 300
Gadget 150
Widget 500

drop_duplicates drops rows that are identical across every column. The answer comes back in a settled order, because dropping repeats says nothing about which order the rest should be in, and an answer that reorders itself between runs is not predictable.

data.frame(a = c(1, 1, 2), b = c("x", "x", "y")) |> drop_duplicates()
a b
1 x
2 y
pd.DataFrame({"a": [1, 1, 2], "b": ["x", "x", "y"]}) >> drop_duplicates()
a b
1 x
2 y