使用python合并行解决冲突优先级

时间:2017-03-09 10:26:11

标签: python pandas merge

INPUT

>>> data
     OrderID            TimeStamp  ErrorCode Duration          ResponseType  \
0    3000000  1488948188555841641        NaN      IOC                   NaN   
1    3000000  1488948188556444675          0      NaN     NEW_ORDER_CONFIRM   
2    3000000  1488948188556448153          2      NaN         TRADE_CONFIRM   

预计输出

>>> data
     OrderID            TimeStamp1           TimeStamp2  ErrorCode Duration       ResponseType     

2    3000000  1488948188555841641  1488948188556448153          0      IOC         TRADE_CONFIRM 

基本上我想根据OrderID折叠2行,但是Errorcode只需要从NEW_ORDER_CONFIRM获取。

更大的问题意图是Use particular column value as key to search in pandas dataframe

0 个答案:

没有答案