Find row number in column where it matches any other value in column of other dataframe

后端 未结 1 1458
傲寒
傲寒 2021-01-22 07:53

I have a code:

import pandas as pd
import numpy as np

arm_1_and_m1_df = pd.DataFrame({ \'record_id\': [1, 4, 3, np.nan],
                   \'two\': [1, 2, np.n         


        
相关标签:
1条回答
  • 2021-01-22 08:07

    Try isin and slicing on index

    a_index = (redcap_final_arm1_data.index[redcap_final_arm1_data.record_id
                                               .isin(arm_1_and_m1_df.record_id)].tolist())
    

    output:

    Out[1355]: [0, 2, 3, 9]
    
    0 讨论(0)
提交回复
热议问题