# Sorting a Dataset by an enumerated column with assigned values

A $$mathtt{Dataset}$$ has a column $$C$$ with enumerated values $$c_i$$, to each of which a number $$n_{c_i}$$ is manually assigned. The $$mathtt{Dataset}$$ needs to be sorted based on the numbers.

MWE: Suggest there’s a $$mathtt{Dataset}$$:

``````ds = Dataset(
Now, for some reason, One’d like to sort the records by Column “Food”, assigning 2 to “Apple”, 1 to “Banana”, and 3 to “Cherry” (maybe 0 to anything else). The result $$mathtt{Dataset}$$ will thus have Column “ID” as $$mathtt{{2, 3, 1, 5, 4}}$$:
``````expectedDs =