Relative Content

Tag Archive for pythonpandasdataframesortingcategorical-data

sorting python dataframe by values in a column based on a list

I have a pandas dataframe which I am trying to sort on the basis of values in a column, but the sorting is not alphabetical. The sorting is based on a “sorter” list (i.e. a list which gives the order in which values should be sorted).
However, I am getting error when I do this.
executable code below: