df = pd.DataFrame(['bit_0', 'bit_2', 'bit_5'], columns=['bit']) df.sort_values('bit' ,key=lambda x: x.str.split("_",expand=True)[1].astype(int))