aggregate

NHibernate Criteria select items by the group by and sum of itemid within another table

夙愿已清 提交于 2019-12-12 12:16:53
问题 public class SearchText { public virtual int Id { get; set; } public virtual string Text { get; set; } } public class SearchTextLog { public virtual int Id { get; set; } public virtual SearchText SearchText { get; set; } public virtual User User { get; set; } public virtual int SearchCount { get; set; } public virtual DateTime LastSearchDate { get; set; } } I am trying to select the top 5 SearchText items based on the sum of their count within the SearchTextLog. Currently I have only been

Constructing Mode and Corresponding Count Functions Using Custom Aggregation Functions for GroupBy in Dask

时光总嘲笑我的痴心妄想 提交于 2019-12-12 11:25:50
问题 So dask has now been updated to support custom aggregation functions for groupby. (Thanks to the dev team and @chmp for working on this!). I am currently trying to construct a mode function and corresponding count function. Basically what I envision is that mode returns a list, for each grouping, of the most common values for a specific column (ie. [4, 1, 2]). Additionally, there is a corresponding count function that returns the number of instances of those values, ie. 3. Now I am currently

Applying an aggregate function over multiple different slices

删除回忆录丶 提交于 2019-12-12 11:19:47
问题 I have a data array that contains some information about people and projects as such: person_id | project_id | action | time -------------------------------------- 1 | 1 | w | 1 1 | 2 | w | 2 1 | 3 | w | 2 1 | 3 | r | 3 1 | 3 | w | 4 1 | 4 | w | 4 2 | 2 | r | 2 2 | 2 | w | 3 I'd like to augment this data with a couple of more fields called "first_time" and "first_time_project" that collectively identify first time any action by that person was seen and the first time that developer saw any

Replicating ddply with the dplyr package? ddply is too slow

送分小仙女□ 提交于 2019-12-12 10:24:17
问题 I am working with some big time series datasets, with about 2million rows in each file. So far I've been using ddply to aggregate the data like I want it to but unfortunately it has become too slow and I really need a faster way. Here is my code: DF <- read.csv(file = "NSE/20151221/AUROPHARMA15DECFUT_20151221_ob.csv",header = FALSE,sep = "", col.names = c("DateTime","Seq","BP1","BQ1","BO1","AP1","AQ1","AO1","BP2","BQ2","BO2","AP2","AQ2","AO2","BP3","BQ3","BO3","AP3","AQ3","AO3","BP4","BQ4",

linq aggregate

╄→гoц情女王★ 提交于 2019-12-12 08:12:46
问题 class Category { public string Name { get; set; } public int Count { get; set;} } Name Count AA 2 BB 3 AA 4 I have an IEnumerable<Category> and would like to get a list of Categories with unique names and the sum of multiple entries Output Name Count AA 6 BB 3 Update class Category { public string Name { get; set; } public int CountA { get; set;} public int CountB { get; set;} public string Phone { get; set;} } How would I sum two columns. and the phone column can be the last row or any row

MongoDB高级操作

点点圈 提交于 2019-12-12 07:33:01
高级操作 2.1. 聚合 aggregate 2.1.1. $group 2.1.2. $match 2.1.3. $project 2.1.4. $sort 2.1.5. l i m i t 、 limit、 l i m i t 、 skip 2.1.6. $unwind 2.2. 安全 2.3. 复制(副本集) 2.4. 备份与恢复 2.5. 与python交互 2.6. 总结 高级操作 讲解关于mongodb的高级操作,包括聚合、主从复制、分片、备份与恢复、MR 完成python与mongodb的交互 聚合 aggregate 聚合(aggregate)主要用于计算数据,类似sql中的sum()、avg() 语法 db.集合名称.aggregate([{管道:{表达式}}]) 管道 管道在Unix和Linux中一般用于将当前命令的输出结果作为下一个命令的输入 ps ajx | grep mongo 在mongodb中,管道具有同样的作用,文档处理完毕后,通过管道进行下一次处理 常用管道 $group:将集合中的文档分组,可用于统计结果 $match:过滤数据,只输出符合条件的文档 $project:修改输入文档的结构,如重命名、增加、删除字段、创建计算结果 $sort:将输入文档排序后输出 $limit:限制聚合管道返回的文档数 $skip:跳过指定数量的文档

Aggregate on dictionary question

China☆狼群 提交于 2019-12-12 05:13:55
问题 I am using ASP.NET MVC2 and I would like to make up a url based on the current one in the address bar inside a HtmlHelper extension. So far I have this: url = helper.ViewContext.RequestContext.RouteData.Values .Aggregate<KeyValuePair<String, Object>>((w, next) => w + next); But that does not compile. Anyone has a good idea on how to solve this Aggregate function? 回答1: Use this: helper.ViewContext.RequestContext.RouteData.Values .Select(x => x.Value.ToString()) .Aggregate((c, next) => c + next

ggplot of aggregated data frame is missing values [closed]

夙愿已清 提交于 2019-12-12 04:49:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I'm trying to ggplot some consolidated data but unfortunately I'm having some loss... df <- Project Subproject Value Date A 1 47 2017-08-04 A 2 22 2017-08-04 B 1 1 2017-08-04 A 1 40 2017-08-07 A 2 29 2017-08-07 B 1 1 2017-08-07 new_df <- df %>% group_by(Project, Date)%>% summarise(Value = sum(Value)) ui <-

merge two daily time series after summarising on shifted hours

拜拜、爱过 提交于 2019-12-12 04:42:58
问题 I have a measurement (for instance solar radiation) indexed with a datetime variable, at an hourly timestamp. What I want to do is to sum the measurement value for each day of the year, and match this to another source of data also at daily scale (let's say mean outdoor temperature). Although, the second source of data is already agregated from 8:00am to 8:00am the next day . I know how to summarise my first variable by standard day, but I need to do it from 8 to 8 in order to match both

Aggregate adjacent rows, ignoring certain columns

好久不见. 提交于 2019-12-12 04:34:43
问题 I have a df like below > head(df) OrderId Timestamp ErrorCode 1 3000000 1455594300434609920 NA 2 3000001 1455594300434614272 NA 3 3000000 1455594300440175104 0 4 3000001 1455594300440179712 0 5 3000002 1455594303468741120 NA 6 3000002 1455594303469326848 0 I need to collapse row in a way that output is something like below > head(df) OrderId Timestamp1 Timestamp2 ErrorCode Diff 3000000 1455594300434609920 1455594300440175104 0 3000001 1455594300434614272 1455594300440179712 0 3000002