如果第一个df列中的项目与第二个DF列中的项目匹配,如何从第二个数据帧中分离出列中的项目?

问题描述

我已根据条件将一个df分为两个不同的df:

条件1

for domain in $(cat all-programs.txt); do
    awk '
    function bar(x){s="";i=0;while (i++ < x) s=s "#";return s}
    BEGIN{
        ("ls -l " ARGV[1]) | getline total;
        split(total,array);
        total=array[5];
    }
    {
        cur+=length($0)+1;
        percent=int(cur / total * 100);
        printf "LINE %s:%s %s%%\r",NR,bar(percent*.8),percent 
    }
    END {print}' very_big_file.json | grep ".$domain" | ...
done

对于上面的代码,我得到的df是:

enter image description here

条件2,

key_df = output[(output['pass.shot_assist'].notna()) & (output['player.name'] == 'Kieran Trippier')].reset_index(drop= True)
key_df.head(5)

为此的df是

enter image description here

第二个DF 中,在 shot.key_pass_id 列中有某些ID(如第一列中所示),其中一些ID是指第一DF 。如果 pass DF 的ID与 shot.key_pass_id

列中的ID相匹配,我需要从 shot DF 中获得这些快照的位置。 >

有人可以帮助我吗?图片中未显示位置 shot.key_pass_id 列,但我可以根据需要提供

P.S-我不知道如何将dfs放在表格中,因此不放在图像上。如果阅读起来很麻烦,对此表示歉意

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)