I have a large Excel data set which I load as Pandas. In one column I have repeating strings/numbers (the information can be a text and or integers), in another column I have a unique identifier of that row, there is also a column with a due date. Using sort_values
I can group the repeating values and sort according to the due dates. But now I would like to add a column containing numbers to get a ranking of the due dates of the first column.
example data:
[[Item, Kind, ID, Client, Duedate],[A, 3, 689, XY, 01.04.2019], [A, 3, 689, XY, 02.04.2019],[B, 3, 689, XY, 01.04.2019],[C, 3, 689, XY, 01.04.2019],[A, 3, 689, XY, 01.04.2018],[C, 3, 689, XY, 01.04.2019]
I sort them so that the output is all the A's first, then all the B's, and within that group they are sorted according to priority. But now I want to extend my data set into looking like this:
[Item, Kind, ID, Client, Duedate, **priority**],[A, 3, 689, XY, 01.04.2018, **0**],[A, 3, 689, XY, 01.04.2019, **1**], [A, 3, 689, XY, 02.04.2019**2**]
if tried looping over the values, but it doesn't seem to work, and I could not find anything on Google to help me. Any hint would be much appreciated, I am stuck with this for 10 days now..