鱼C论坛

 找回密码
 立即注册
查看: 325|回复: 4

拍卖会的竞拍

[复制链接]
发表于 2020-4-11 16:29:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
就是最高者得标,但是只需要付第二高的人的钱。
现在我的csv里有商品title,商品编号(item_num),价格(price)和竞标人(bidder)
我需要从csv里面提取数据,然后写出一个function。
就像
>>> vickrey_auction("bid_info.csv", "AGGREGATES, HOT MIX ASPHALT(HWYS)", 9)
('TILCON NEW YORK INC', 38.2)
>>> vickrey_auction("bid_info.csv", "AGGREGATES, HOT MIX ASPHALT(HWYS)", 10)
('TILCON NEW YORK INC', 36.97)
>>> vickrey_auction("bid_info.csv", "AGGREGATES, HOT MIX ASPHALT(HWYS)", 13)
('TILCON NEW YORK INC', 36.76)
我已经写出来了如何提取
import csv

def read_csv(path):
  rows = []
  with open(path) as csvfile:
    file_reader = csv.reader(csvfile)
    for row in file_reader:
      rows.append(list(row))
  return rows

但是不知道怎么写function了。

这是我的csv
TITLE        ITEM_NUM        BIDDER        PRICE
AGGREGATES, HOT MIX ASPHALT(HWYS)        9        TILCON NEW YORK INC        38.2
AGGREGATES, HOT MIX ASPHALT(HWYS)        13        NEW YORK SAND & STONE LLC        36.76
AGGREGATES, HOT MIX ASPHALT(HWYS)        13        TILCON NEW YORK INC        39.71
AGGREGATES, HOT MIX ASPHALT(HWYS)        14        NEW YORK SAND & STONE LLC        37.45
AGGREGATES, HOT MIX ASPHALT(HWYS)        14        TILCON NEW YORK INC        38.47
AGGREGATES, HOT MIX ASPHALT(HWYS)        15        NEW YORK SAND & STONE LLC        38.21
AGGREGATES, HOT MIX ASPHALT(HWYS)        15        TILCON NEW YORK INC        39.27
AGGREGATES, HOT MIX ASPHALT(HWYS)        16        NEW YORK SAND & STONE LLC        38.64
AWD POLICE SEDAN - NYPD        1        BEYER OF MORRISTOWN LLC        27600
AWD POLICE SEDAN - NYPD        1        MAJOR WORLD CDJR LLC DBA MAJOR        26563
AWD POLICE SEDAN - NYPD        1        ROBERT GREEN AUTO & TRUCK INC        25962
AWD POLICE SEDAN - NYPD        10        BEYER OF MORRISTOWN LLC        5061
AWD POLICE SEDAN - NYPD        10        MAJOR WORLD CDJR LLC DBA MAJOR        3500
AWD POLICE SEDAN - NYPD        10        ROBERT GREEN AUTO & TRUCK INC        4415
AWD POLICE SEDAN - NYPD        11        BEYER OF MORRISTOWN LLC        924
AWD POLICE SEDAN - NYPD        11        MAJOR WORLD CDJR LLC DBA MAJOR        536
AWD POLICE SEDAN - NYPD        11        ROBERT GREEN AUTO & TRUCK INC        667
AWD POLICE SEDAN - NYPD        12        BEYER OF MORRISTOWN LLC        360
AWD POLICE SEDAN - NYPD        12        MAJOR WORLD CDJR LLC DBA MAJOR        210
AWD POLICE SEDAN - NYPD        12        ROBERT GREEN AUTO & TRUCK INC        321
AWD POLICE SEDAN - NYPD        13        BEYER OF MORRISTOWN LLC        465
AWD POLICE SEDAN - NYPD        13        MAJOR WORLD CDJR LLC DBA MAJOR        400
AWD POLICE SEDAN - NYPD        13        ROBERT GREEN AUTO & TRUCK INC        414
AWD POLICE SEDAN - NYPD        14        BEYER OF MORRISTOWN LLC        271
AWD POLICE SEDAN - NYPD        14        MAJOR WORLD CDJR LLC DBA MAJOR        350
AWD POLICE SEDAN - NYPD        14        ROBERT GREEN AUTO & TRUCK INC        166
AWD POLICE SEDAN - NYPD        15        BEYER OF MORRISTOWN LLC        92
AWD POLICE SEDAN - NYPD        15        MAJOR WORLD CDJR LLC DBA MAJOR        100
AWD POLICE SEDAN - NYPD        15        ROBERT GREEN AUTO & TRUCK INC        75
AWD POLICE SEDAN - NYPD        16        BEYER OF MORRISTOWN LLC        564
AWD POLICE SEDAN - NYPD        16        MAJOR WORLD CDJR LLC DBA MAJOR        471
AWD POLICE SEDAN - NYPD        16        ROBERT GREEN AUTO & TRUCK INC        440
AWD POLICE SEDAN - NYPD        17        MAJOR WORLD CDJR LLC DBA MAJOR        541
AWD POLICE SEDAN - NYPD        17        ROBERT GREEN AUTO & TRUCK INC        870
AWD POLICE SEDAN - NYPD        18        BEYER OF MORRISTOWN LLC        7454
AWD POLICE SEDAN - NYPD        18        MAJOR WORLD CDJR LLC DBA MAJOR        6011
AWD POLICE SEDAN - NYPD        18        ROBERT GREEN AUTO & TRUCK INC        5931
AWD POLICE SEDAN - NYPD        19        BEYER OF MORRISTOWN LLC        2435
AWD POLICE SEDAN - NYPD        19        MAJOR WORLD CDJR LLC DBA MAJOR        2935
AWD POLICE SEDAN - NYPD        19        ROBERT GREEN AUTO & TRUCK INC        2635
AWD POLICE SEDAN - NYPD        2        BEYER OF MORRISTOWN LLC        11509
AWD POLICE SEDAN - NYPD        2        MAJOR WORLD CDJR LLC DBA MAJOR        7816
LIQUID HANDLING WORKSTATIONS RE-AD        28        HAMILTON ROBOTICS        2674
LIQUID HANDLING WORKSTATIONS RE-AD        29        HAMILTON ROBOTICS        1867.6
LIQUID HANDLING WORKSTATIONS RE-AD        3        HAMILTON ROBOTICS        32000
LIQUID HANDLING WORKSTATIONS RE-AD        30        HAMILTON ROBOTICS        2600
LIQUID HANDLING WORKSTATIONS RE-AD        31        HAMILTON ROBOTICS        110
LIQUID HANDLING WORKSTATIONS RE-AD        35        HAMILTON ROBOTICS        1000
LIQUID HANDLING WORKSTATIONS RE-AD        4        HAMILTON ROBOTICS        2800
LIQUID HANDLING WORKSTATIONS RE-AD        5        HAMILTON ROBOTICS        6400
LIQUID HANDLING WORKSTATIONS RE-AD        6        HAMILTON ROBOTICS        420
LIQUID HANDLING WORKSTATIONS RE-AD        7        HAMILTON ROBOTICS        5900
LIQUID HANDLING WORKSTATIONS RE-AD        8        HAMILTON ROBOTICS        1250
LIQUID HANDLING WORKSTATIONS RE-AD        9        HAMILTON ROBOTICS        720
VEHICLE: ALL PURPOSE UTILITY, ATV        1        ARGENTO & SONS INC        11465.09
VEHICLE: ALL PURPOSE UTILITY, ATV        1        BAY HARBOR MOTORS CORP        12269
VEHICLE: ALL PURPOSE UTILITY, ATV        1        BOBCAT OF NEW YORK INC        13258
VEHICLE: ALL PURPOSE UTILITY, ATV        1        CHIEF EQUIPMENT INC        11213.11
VEHICLE: ALL PURPOSE UTILITY, ATV        1        KEIL EQUIPMENT COMPANY INC        11591.08
VEHICLE: ALL PURPOSE UTILITY, ATV        10        ARGENTO & SONS INC        13012.09
VEHICLE: ALL PURPOSE UTILITY, ATV        10        BAY HARBOR MOTORS CORP        12099
VEHICLE: ALL PURPOSE UTILITY, ATV        10        BOBCAT OF NEW YORK INC        14039
VEHICLE: ALL PURPOSE UTILITY, ATV        10        CHIEF EQUIPMENT INC        12726.11
VEHICLE: ALL PURPOSE UTILITY, ATV        10        KEIL EQUIPMENT COMPANY INC        13155.08
VEHICLE: ALL PURPOSE UTILITY, ATV        10        ARGENTO & SONS INC        91000
VEHICLE: ALL PURPOSE UTILITY, ATV        10        BAY HARBOR MOTORS CORP        86000
VEHICLE: ALL PURPOSE UTILITY, ATV        10        CHIEF EQUIPMENT INC        89000
VEHICLE: ALL PURPOSE UTILITY, ATV        10        KEIL EQUIPMENT COMPANY INC        92000
VEHICLE: ALL PURPOSE UTILITY, ATV        11        ARGENTO & SONS INC        8862.49
VEHICLE: ALL PURPOSE UTILITY, ATV        11        BAY HARBOR MOTORS CORP        9609
VEHICLE: ALL PURPOSE UTILITY, ATV        11        CHIEF EQUIPMENT INC        8667.71
VEHICLE: ALL PURPOSE UTILITY, ATV        11        KEIL EQUIPMENT COMPANY INC        8959.88
VEHICLE: ALL PURPOSE UTILITY, ATV        12        ARGENTO & SONS INC        11192.09
VEHICLE: ALL PURPOSE UTILITY, ATV        12        BAY HARBOR MOTORS CORP        11989
VEHICLE: ALL PURPOSE UTILITY, ATV        12        CHIEF EQUIPMENT INC        10946.11
VEHICLE: ALL PURPOSE UTILITY, ATV        12        KEIL EQUIPMENT COMPANY INC        11315.08
VEHICLE: ALL PURPOSE UTILITY, ATV        13        ARGENTO & SONS INC        7679.49
VEHICLE: ALL PURPOSE UTILITY, ATV        13        BAY HARBOR MOTORS CORP        8249
VEHICLE: ALL PURPOSE UTILITY, ATV        13        CHIEF EQUIPMENT INC        7243.71
VEHICLE: ALL PURPOSE UTILITY, ATV        13        KEIL EQUIPMENT COMPANY INC        7487.88
VEHICLE: ALL PURPOSE UTILITY, ATV        2        ARGENTO & SONS INC        10354.89
VEHICLE: ALL PURPOSE UTILITY, ATV        2        BAY HARBOR MOTORS CORP        6889
VEHICLE: ALL PURPOSE UTILITY, ATV        2        CHIEF EQUIPMENT INC        10127.31
VEHICLE: ALL PURPOSE UTILITY, ATV        2        KEIL EQUIPMENT COMPANY INC        10468.68
VEHICLE: ALL PURPOSE UTILITY, ATV        3        ARGENTO & SONS INC        7461.09
VEHICLE: ALL PURPOSE UTILITY, ATV        3        BOBCAT OF NEW YORK INC        11428
VEHICLE: ALL PURPOSE UTILITY, ATV        3        CHIEF EQUIPMENT INC        7297.11
VEHICLE: ALL PURPOSE UTILITY, ATV        3        KEIL EQUIPMENT COMPANY INC        7543.08
VEHICLE: ALL PURPOSE UTILITY, ATV        4        ARGENTO & SONS INC        6341.79
VEHICLE: ALL PURPOSE UTILITY, ATV        4        CHIEF EQUIPMENT INC        6202.41
VEHICLE: ALL PURPOSE UTILITY, ATV        4        KEIL EQUIPMENT COMPANY INC        6411.48
VEHICLE: ALL PURPOSE UTILITY, ATV        5        ARGENTO & SONS INC        9881.69
VEHICLE: ALL PURPOSE UTILITY, ATV        5        BAY HARBOR MOTORS CORP        9906
VEHICLE: ALL PURPOSE UTILITY, ATV        5        BOBCAT OF NEW YORK INC        10839
VEHICLE: ALL PURPOSE UTILITY, ATV        5        CHIEF EQUIPMENT INC        9664.51
VEHICLE: ALL PURPOSE UTILITY, ATV        5        KEIL EQUIPMENT COMPANY INC        9990.28
VEHICLE: ALL PURPOSE UTILITY, ATV        6        ARGENTO & SONS INC        10973.69
VEHICLE: ALL PURPOSE UTILITY, ATV        6        BAY HARBOR MOTORS CORP        11249
VEHICLE: ALL PURPOSE UTILITY, ATV        6        BOBCAT OF NEW YORK INC        11302
VEHICLE: ALL PURPOSE UTILITY, ATV        6        CHIEF EQUIPMENT INC        10732.51
VEHICLE: ALL PURPOSE UTILITY, ATV        6        KEIL EQUIPMENT COMPANY INC        11094.28
VEHICLE: ALL PURPOSE UTILITY, ATV        7        ARGENTO & SONS INC        11974.69
VEHICLE: ALL PURPOSE UTILITY, ATV        7        CHIEF EQUIPMENT INC        11711.51
VEHICLE: ALL PURPOSE UTILITY, ATV        7        KEIL EQUIPMENT COMPANY INC        12106.28
VEHICLE: ALL PURPOSE UTILITY, ATV        8        ARGENTO & SONS INC        13430.69
VEHICLE: ALL PURPOSE UTILITY, ATV        8        BAY HARBOR MOTORS CORP        14564
VEHICLE: ALL PURPOSE UTILITY, ATV        8        BOBCAT OF NEW YORK INC        12460
VEHICLE: ALL PURPOSE UTILITY, ATV        8        CHIEF EQUIPMENT INC        13135.51
VEHICLE: ALL PURPOSE UTILITY, ATV        9        ARGENTO & SONS INC        12011.09
VEHICLE: ALL PURPOSE UTILITY, ATV        9        CHIEF EQUIPMENT INC        11747.11
VEHICLE: ALL PURPOSE UTILITY, ATV        9        KEIL EQUIPMENT COMPANY INC        12143.08
VEHICLE: ALL PURPOSE UTILITY, ATV        9        KEIL EQUIPMENT COMPANY INC        82000
VEHICLE: ALL PURPOSE UTILITY, ATV        14        ARGENTO & SONS INC        31535
VEHICLE: ALL PURPOSE UTILITY, ATV        14        BAY HARBOR MOTORS CORP        45900
VEHICLE: ALL PURPOSE UTILITY, ATV        14        BOBCAT OF NEW YORK INC        30388
VEHICLE: ALL PURPOSE UTILITY, ATV        14        CHIEF EQUIPMENT INC        26712
VEHICLE: ALL PURPOSE UTILITY, ATV        14        KEIL EQUIPMENT COMPANY INC        32277
VEHICLE: ALL PURPOSE UTILITY, ATV        14        ARGENTO & SONS INC        85000
VEHICLE: ALL PURPOSE UTILITY, ATV        14        BAY HARBOR MOTORS CORP        100000
VEHICLE: ALL PURPOSE UTILITY, ATV        14        CHIEF EQUIPMENT INC        72000
VEHICLE: ALL PURPOSE UTILITY, ATV        14        KEIL EQUIPMENT COMPANY INC        87000
VEHICLE: ALL PURPOSE UTILITY, ATV        15        ARGENTO & SONS INC        37587.85
VEHICLE: ALL PURPOSE UTILITY, ATV        15        BAY HARBOR MOTORS CORP        52789
VEHICLE: ALL PURPOSE UTILITY, ATV        15        BOBCAT OF NEW YORK INC        34031
VEHICLE: ALL PURPOSE UTILITY, ATV        15        CHIEF EQUIPMENT INC        31839.12
VEHICLE: ALL PURPOSE UTILITY, ATV        15        KEIL EQUIPMENT COMPANY INC        38472.27
VEHICLE: ALL PURPOSE UTILITY, ATV        16        ARGENTO & SONS INC        44554.45
VEHICLE: ALL PURPOSE UTILITY, ATV        16        BAY HARBOR MOTORS CORP        64540
VEHICLE: ALL PURPOSE UTILITY, ATV        16        BOBCAT OF NEW YORK INC        41880
VEHICLE: ALL PURPOSE UTILITY, ATV        16        CHIEF EQUIPMENT INC        37740.24
VEHICLE: ALL PURPOSE UTILITY, ATV        16        KEIL EQUIPMENT COMPANY INC        45601.79
PROMOTIONAL ITEMS AND APPAREL        15        INTL PROMOTIONAL IDEAS INC        3250000
PROMOTIONAL ITEMS AND APPAREL        15        MEZZOPRINT LLC        2375000
PROMOTIONAL ITEMS AND APPAREL        15        POSITIVE PROMOTIONS INC        3500000
PROMOTIONAL ITEMS AND APPAREL        15        VANGUARD DIRECT INC        2220000
PROMOTIONAL ITEMS AND APPAREL        16        AMC PROMOTIONAL PRODUCTS        24
PROMOTIONAL ITEMS AND APPAREL        16        BILLING CODING AND PRINTING IN        60
PROMOTIONAL ITEMS AND APPAREL        16        INTL PROMOTIONAL IDEAS INC        40
PROMOTIONAL ITEMS AND APPAREL        16        MEZZOPRINT LLC        45
PROMOTIONAL ITEMS AND APPAREL        16        POSITIVE PROMOTIONS INC        30.79
PROMOTIONAL ITEMS AND APPAREL        16        VANGUARD DIRECT INC        90
TRUCK, WELDING - DSNY        1        GABRIELLI TRUCK SALES LTD        147172
TRUCK, WELDING - DSNY        1        GABRIELLI TRUCK SALES LTD        294344
TRUCK, WELDING - DSNY        2        GABRIELLI TRUCK SALES LTD        219.72
TRUCK, WELDING - DSNY        3        GABRIELLI TRUCK SALES LTD        1026
TRUCK, WELDING - DSNY        4        GABRIELLI TRUCK SALES LTD        75.03
TRUCK, WELDING - DSNY        5        GABRIELLI TRUCK SALES LTD        525
TRUCK, WELDING - DSNY        7        GABRIELLI TRUCK SALES LTD        1225
TRUCK, WELDING - DSNY        8        GABRIELLI TRUCK SALES LTD        965
TRUCK, WELDING - DSNY        9        GABRIELLI TRUCK SALES LTD        1850
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        ABM FACILITY SERVICES        2156
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        EVOCHARGE INC        1259.1
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        FINESSE CREATIONS INC        3120
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        GREEN POWER TECHNOLOGY LLC        2830
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        LEVITON MANUFACTURING CO INC        3344.86
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        SAMBA ENERGY        2182.95
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        ABM FACILITY SERVICES        1916
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        FINESSE CREATIONS INC        2705
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        GREEN POWER TECHNOLOGY LLC        2494
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        SAMBA ENERGY        1939.95
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        ABM FACILITY SERVICES        205
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        EVOCHARGE INC        264
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        ABM FACILITY SERVICES        3.3
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        EVOCHARGE INC        6
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        FINESSE CREATIONS INC        4.3
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        GREEN POWER TECHNOLOGY LLC        3.5
ELECTRIC VEHICLE SUPPLY EQUIPMENT        1        SAMBA ENERGY        4.5
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        3604
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        EVOCHARGE INC        1889.1
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        5324.4
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        5085
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        4853.33
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        3650
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        3192
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        4900.8
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        4750
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        4420.9
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        3232
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        5364
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        EVOCHARGE INC        3778.2
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        7303.2
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        6515
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        7310.99
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        5431
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        4952
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        6878.4
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        6180
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        6885.77
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        5013.9
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        4009
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        EVOCHARGE INC        2789.1
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        5742
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        5415
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        5292.97
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        4058
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        3596
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        5318.4
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        5080
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        4860.54
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        3640.95
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        5768
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        EVOCHARGE INC        4679.1
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        7720.8
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        6845
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        7750.63
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        5840
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        5356
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        FINESSE CREATIONS INC        7297.2
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        6510
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        LEVITON MANUFACTURING CO INC        7325.41
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        SAMBA ENERGY        5422.95
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        ABM FACILITY SERVICES        280
ELECTRIC VEHICLE SUPPLY EQUIPMENT        2        GREEN POWER TECHNOLOGY LLC        705
ELECTRIC VEHICLE SUPPLY EQUIPMENT        3        ABM FACILITY SERVICES        35800
ELECTRIC VEHICLE SUPPLY EQUIPMENT        3        FINESSE CREATIONS INC        45292.8
ELECTRIC VEHICLE SUPPLY EQUIPMENT        3        GREEN POWER TECHNOLOGY LLC        34432
ELECTRIC VEHICLE SUPPLY EQUIPMENT        3        SAMBA ENERGY        34010
ELECTRIC VEHICLE SUPPLY EQUIPMENT        3        ABM FACILITY SERVICES        560
ELECTRIC VEHICLE SUPPLY EQUIPMENT        3        GREEN POWER TECHNOLOGY LLC        1410
AGGREGATES, HOT MIX ASPHALT(HWYS)        1        NEW YORK SAND & STONE LLC        49.21
AGGREGATES, HOT MIX ASPHALT(HWYS)        1        TILCON NEW YORK INC        39.74
AGGREGATES, HOT MIX ASPHALT(HWYS)        3        NEW YORK SAND & STONE LLC        47.7
AGGREGATES, HOT MIX ASPHALT(HWYS)        3        TILCON NEW YORK INC        38.7
AGGREGATES, HOT MIX ASPHALT(HWYS)        4        NEW YORK SAND & STONE LLC        48.67
AGGREGATES, HOT MIX ASPHALT(HWYS)        6        TILCON NEW YORK INC        38.61
AGGREGATES, HOT MIX ASPHALT(HWYS)        10        TILCON NEW YORK INC        36.97
AGGREGATES, HOT MIX ASPHALT(HWYS)        11        TILCON NEW YORK INC        37.76

TRUCK, WRECKER 8 & 10 TON - DOT        14        GABRIELLI TRUCK SALES LTD        10000

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-4-11 16:36:11 | 显示全部楼层
你这数据怎么计算的?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-4-11 17:25:16 | 显示全部楼层

就是看最高的price是谁,然后负第二名的钱
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-4-11 17:37:50 | 显示全部楼层
hnldyxx551 发表于 2020-4-11 17:25
就是看最高的price是谁,然后负第二名的钱
>>> vickrey_auction("bid_info.csv", "AGGREGATES, HOT MIX ASPHALT(HWYS)", 9)
('TILCON NEW YORK INC', 38.2)
怎么得出来的?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-4-12 09:45:47 | 显示全部楼层
import heapq
from pprint import pprint
portfolio = [
    {'name': 'IBM', 'shares': 100, 'price': 91.1},
    {'name': 'AAPL', 'shares': 50, 'price': 543.22},
    {'name': 'FB', 'shares': 200, 'price': 21.09},
    {'name': 'HPQ', 'shares': 35, 'price': 31.75},
    {'name': 'YHOO', 'shares': 45, 'price': 16.35},
    {'name': 'ACME', 'shares': 75, 'price': 115.65}
]
cheap = heapq.nsmallest(2, portfolio, key=lambda s: s['price'])#输出2个价格最小的
expensive = heapq.nlargest(3, portfolio, key=lambda s: s['shares'])##输出3个share最大的
pprint(cheap)
print('+++++++++++++++++')
pprint(expensive)

你把查找出来的数据放入到一个列表中, 然后用堆去取. 看下我上面的代码例子
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-26 08:20

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表