Python 3.x 单个数据点相对于参考数据集的排名

Python 3.x 单个数据点相对于参考数据集的排名,python-3.x,pandas,dataframe,Python 3.x,Pandas,Dataframe,我有以下假设数据帧: data = {'score1':[60, 30, 80, 120], 'score2':[20, 21, 19, 18], 'score3':[12, 43, 71, 90]} # Create the pandas DataFrame df = pd.DataFrame(data) # calculating the ranks df['score1_rank'] = df['score1'].rank(pct = True) d

我有以下假设数据帧:

data = {'score1':[60, 30, 80, 120],
        'score2':[20, 21, 19, 18],
       'score3':[12, 43, 71, 90]}
  
# Create the pandas DataFrame
df = pd.DataFrame(data)


# calculating the ranks
df['score1_rank'] = df['score1'].rank(pct = True)
df['score2_rank'] = df['score2'].rank(pct = True)
df['score3_rank'] = df['score3'].rank(pct = True)

然后,我想根据参考文献对各个数据点进行排名,例如:

data_to_test = {'score1':[12],
        'score2':[4],
       'score3':[6]}
如何将这些新值与此参考值进行比较


谢谢你的帮助

你的问题到底是什么?你想用这本词典做什么<代码>如何将这些新值与此参考进行比较-哪个新值value@anky问题中有两组数据,用于制作dataframe的字典和我想比较的第二个字典(虽然这些是抽象的,但第二个比较集可以是任何值):如问题中所述:然后,我想根据引用对各个数据点进行排序,例如:data={'score1':[12],'score2':[4] ,'score3':[6]}您希望得到什么结果?例如,
data=[50,22,88]
@corrarien是的,确实是这样。我只是不知道如何针对任何给定的数据点使用参考数据