我有这个代码:
var tradeReqsBySegment = segGroups.Join(pPeriods, s => s.MarketSegmentId, p => p.EntityId, (s, p) => new
{
SegmentCode = s.SegmentCode, // string
Time = p.StartLocal, // datetime
TradeRequirement = p.Volume // double
})
.GroupBy(s => s.SegmentCode)
.ToDictionary(g => g.Key, g => g.ToDictionary(i => i.Time, i=>i.TradeRequirement));
我希望g.ToDictionary(i => i.Time, i=>i.TradeRequirement))
按时间分组,并TradeRequirement
总结或平均。我该如何处理?
此外,是否可以按月对时间进行分组,例如 get :
Time - TradeReq
01/2013 - 500
02/2013 - 234
...