I have a dataframe
import pandas as pd
import numpy as np
df = pd.DataFrame({'Date':['01-01-2020','01-01-2020','01-01-2020','01-01-2020','01-01-2020'],
'Shift':['A','A','A','A','A'],
'heat_number':['HA1','HA10','HA8','HA18A','HA5']})
Looking like this
Date Shift heat_number
0 01-01-2020 A HA1
1 01-01-2020 A HA10
2 01-01-2020 A HA8
3 01-01-2020 A HA18A
4 01-01-2020 A HA5
5 01-01-2020 A HA18
if i do df.sort_values(['Date','Shift',heat_number])
I get the below output:
Date Shift heat_number
0 01-01-2020 A HA1
1 01-01-2020 A HA10
5 01-01-2020 A HA18
3 01-01-2020 A HA18A
4 01-01-2020 A HA5
2 01-01-2020 A HA8
But my desired output is:
Date Shift heat_number
0 01-01-2020 A HA1
4 01-01-2020 A HA5
2 01-01-2020 A HA8
1 01-01-2020 A HA10
5 01-01-2020 A HA18
3 01-01-2020 A HA18A
Filter in the heat number column is not as per expectation. How can i fix this?
[https://github.com/pandas-dev/pandas/issues/3942#issuecomment-508588258]regarding this issue.