小编St_*_*ual的帖子

Pandas-根据列值查找一行中的第一次出现

我有以下数据框:

 Row    Bid_price   Bid_volume  Ask_price   Ask_volume
 2      2999.0      786.7      -500.0       1403.2
 3      3000.0      786.7      -499.9       1407.2
 4      2950.0      787.3      -250.1       1407.2
---------------------
 56     125.1       2691       36.9         3113.1
 57     125         2691.1     37           3133.1
---------------------
 117    41.4        3029.7     2999         3835.7
 118    40.05       3029.7     3000         3835.7
---------------------
 123    39.4        3129.7     NaN          NaN
 124    36.1        3129.7     NaN          NaN
 125    36          3134.7     NaN          NaN
Run Code Online (Sandbox Code Playgroud)

我需要取第一对Bid_price and Bid_volume (2999.0 and 786.7)并与所有对进行比较Ask_price and Ask_volume。只要Bid_volume < Ask_volume AND Bid_price > Ask_price我跳到下一对Bid_price …

python dataframe pandas

5
推荐指数
1
解决办法
78
查看次数

标签 统计

dataframe ×1

pandas ×1

python ×1