我有2个数据帧
>>> new
OrderID TimeStamp ErrorCode Duration ResponseType \
1 3000000 1488948188556444675 0 IOC NEW_ORDER_CONFIRM
4 3000001 1488948658787811582 1 IOC NEW_ORDER_CONFIRM
8 3000003 1488949109654294973 1 IOC NEW_ORDER_CONFIRM
11 3000004 1488949129882309795 0 IOC NEW_ORDER_CONFIRM
14 3000005 1488949156441102746 1 IOC NEW_ORDER_CONFIRM
和
>>> new2
OrderID TimeStamp ErrorCode Duration ResponseType \
1 3000000 1488948188556444675 0 IOC TRADE_CONFIRM
4 3000000 1488948658787811582 1 IOC CANCEL_ORDER_CONFIRM
8 3000000 1488949109654294973 1 IOC TRADE_CONFIRM
11 3000001 1488949129882309795 0 IOC CANCEL_ORDER_CONFIRM
11 3000001 1488949129882309795 0 IOC TRADE_CONFIRM
14 3000003 1488949156441102746 1 IOC TRADE_CONFIRM
44 3000004 1488949156441102746 1 IOC TRADE_CONFIRM
34 3000005 1488949156441102746 1 IOC TRADE_CONFIRM
24 3000009 1488949156441102746 1 IOC TRADE_CONFIRM
我想将new.orderID映射到new2.orderID,这样只会考虑new中的键,并且会返回new中该键的第一个实例。
例如。 OrderID 3000000有3个响应,但只应考虑第1个。
运算
>>> new
OrderID TimeStamp ErrorCode Duration ResponseType \
1 3000000 1488948188556444675 0 IOC TRADE_CONFIRM
4 3000001 1488948658787811582 1 IOC CANCEL_ORDER_CONFIRM
8 3000003 1488949109654294973 1 IOC TRADE_CONFIRM
11 3000004 1488949129882309795 0 IOC TRADE_CONFIRM
14 3000005 1488949156441102746 1 IOC TRADE_CONFIRM