convert the values to integer:
df['contig'] = df['contig'].astype(int)
df['pos'] = df['pos'].astype(int)
Then sort with inplace
df.sort_values(by=['contig', 'pos'], inplace=True, ascending=True)
from : https://stackoverflow.com/questions/43396993/pandas-is-treating-integer-values-as-strings-while-sorting-why/43400971
No comments:
Post a Comment