直接通过例子看比较好理解. import pandas as pd data = [[1, 2, 3], [2, 2, 2], [7, 8, 9]] df = pd.DataFrame(data, index=['a', 'b', 'c'], columns=['i', 'j', 'k']) print(df) ''' i j k a 1 2 3 b 2 2 2 c 7 8 9 ''' value = 10 print((df.k - value).abs().argsort()) # 根据(d…