我犯了一個小錯誤,我不確定如何正確合并兩個 df 。我想合并 IBES_cusip 以將 gvkey 放入 df1。我嘗試以下操作,但它只是擴展數(shù)據(jù)集并且不正確匹配:df1 = df1.merge(df2, how = 'left', on =['IBES_cusip'])df1 IBES_cusip pends pdicity ... ltg_eps futepsgrowth 0 00036110 1983-05-31 ANN ... NaN NaN 1 00036110 1983-05-31 ANN ... NaN NaN 2 00036110 1983-05-31 ANN ... NaN NaN 3 98970110 1983-05-31 ANN ... NaN NaN 4 98970110 1983-05-31 ANN ... NaN NaN ... ... ... ... ... ... 373472 98970111 2018-12-31 ANN ... 10.00 0.381119 373473 98970111 2018-12-31 df2 gvkey IBES_cusip0 024538 860370101 004678 337915102 066367 263578103 137024 06985P204 137024 06985P20 ... ...833796 028955 33975610833797 061676 17737610833798 011096 92035510833799 005774 44448210833800 008286 69489010
在同一列上從 df1 合并到 df2 - 擴展數(shù)據(jù)集
月關(guān)寶盒
2023-10-18 21:01:09