Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/322.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在第一列中的值较小,但在第二列中的值较高?_Python_Python 3.x_Pandas_Dataframe_Numpy - Fatal编程技术网

Python dataframe在第一列中的值较小,但在第二列中的值较高?

Python dataframe在第一列中的值较小,但在第二列中的值较高?,python,python-3.x,pandas,dataframe,numpy,Python,Python 3.x,Pandas,Dataframe,Numpy,我有两个专栏。我想得到那些排。其中第一列的值较小,但第二列的值较大 id first- column second-column 0 2 1 1 1 9 2 3 5 3 7 2 4 0 1 5 9 3 6 1 5 7 7

我有两个专栏。我想得到那些排。其中第一列的值较小,但第二列的值较大

id first- column second-column
0     2               1
1     1               9
2     3               5
3     7               2
4     0               1
5     9               3
6     1               5
7     7               2
我想要这样的结果

id first-column  second-column
1    1             9

您可以创建一个遮罩,例如:

mask = df.first_column < df.second_column
输出:

   first_column second_column
1  1            3
2  3            5
4  0            1
6  1            5
   first_column second_column
1  1            3
2  3            5
4  0            1
6  1            5