diff --git a/distance_batsim_output.py b/distance_batsim_output.py
index 3f32433b047682d76281387040779b8c1f41bc94..b8938a8bb8f3c2c4b64a82139c6d71d166b50414 100755
--- a/distance_batsim_output.py
+++ b/distance_batsim_output.py
@@ -21,9 +21,8 @@ def clean_and_select(df):
     select.job_id = select.job_id.astype(str)
     select["job_id"] = select["job_id"].str.split(':', expand=True)[0]
     select.job_id = select.job_id.astype(int)
-    select.sort_values(by="job_id")
 
-    return select.set_index("job_id")
+    return select.sort_values(by="job_id").set_index("job_id")
 
 
 def open_and_compare(file1, file2):