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

时间:2020-09-13 15:05:16

标签: python pandas dataframe google-colaboratory series

我已根据条件将一个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 shot DF 中获得这些快照的位置。 >

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

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

0 个答案:

没有答案
相关问题