【发布时间】:2020-03-09 04:56:52
【问题描述】:
我有以下数据框标题: Instrument ClosedVolume NetRevenue TradePnL
在我的交易数据中,我多次交易同一工具导致不同的 TradePnL。
我想总结一下,或者如果可能的话,重申我数据框中的所有不同工具。
例如,我想获取我的阿里巴巴的所有交易数据,使TradePnL为正,我应该怎么做?
sum(df['TradePnL'] ) #should give me my tradePnL of all my trades
df[df['Instrument'] == "Alibaba"] #this will give me all instruments data with Alibaba
【问题讨论】:
标签: python arrays pandas numpy dataframe