Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何比较dataframe和result add as row这两个数据帧?_Python_Pandas_Dataframe - Fatal编程技术网

Python 如何比较dataframe和result add as row这两个数据帧?

Python 如何比较dataframe和result add as row这两个数据帧?,python,pandas,dataframe,Python,Pandas,Dataframe,我有两个数据帧,像第一个数据场 index a b c d 0 4 5 3 2 1 1 10 21 34 2 3 32 1 45 3 56 42 42 23 第二数据帧 index a b c d LL 2 2 2 1 UL 42 2 1 8 我想要这样的例外输出 index a b c d LL

我有两个数据帧,像第一个数据场

index  a   b   c   d
  0    4   5   3   2
  1    1   10  21  34
  2    3   32  1   45
  3    56  42  42  23
第二数据帧

 index   a  b  c  d
  LL    2  2  2  1
  UL    42 2  1  8
我想要这样的例外输出

 index    a       b           c           d
  LL      2       2           2           1
  UL      42      2           1           8
  Result [1,56] [5,10,32,42] [3,21,1,42] [34,45,23]
我是这样做的

 cond = (dd1<dd2.loc['LL',:]) | (dd1>dd2.loc['UL',:])

 dd3=dd2.append(dd1[cond].apply(lambda x : list(x.dropna())),ignore_index=True)
cond=(dd1dd2.loc['UL',:])
dd3=dd2.append(dd1[cond].apply(lambda x:list(x.dropna()),ignore_index=True)

为什么行
结果
具有不同的长度列表?