Questions tagged [grouping]

The process of grouping entities into collections of associated elements.

Grouping is a form of hierarchical knowledge representation, similar to mind mapping, concept mapping and argument mapping, all of which need to observe at least some of the principles of grouping.

SQL Server - Indicates whether a specified column expression in a GROUP BY list is aggregated or not. Read more about this

Wiki Links

7381 questions
10
votes
3 answers

Grouping by a Map value in Java 8 using streams

I have a List of Map that i want to group it by the key nom using java streams. [ { "dateDebut": "2018-07-01T00:00:00.000+0000", "nom": "Julien Mannone", "etat": "Impayé" }, { "dateDebut":…
Wassim Makni
  • 471
  • 2
  • 9
  • 21
10
votes
2 answers

How to add sequence number for groups in a SQL query without temp tables

I've created a complex search query in SQL 2008 that returns data sorted by groups, and the query itself has paging and sorting functions in it, but rather than returning a set number of records based on the paging options, it needs to return a set…
Jacob
  • 383
  • 1
  • 5
  • 11
10
votes
1 answer

pandas grouper vs time grouper

The new pandas version deprecates the TimeGrouper, so we should use the regular Grouper. The old code: df['column_name'].groupby(pd.TimeGrouper("M")).mean().plot() works fine in the old version of pandas. However, none…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
10
votes
5 answers

Grouping and counting to get a closerate

I want to count per country the number of times the status is open and the number of times the status is closed. Then calculate the closerate per country. Data: customer <- c(1,2,3,4,5,6,7,8,9) country <- c('BE', 'NL',…
Rhulsb
  • 303
  • 2
  • 5
10
votes
2 answers

d3 accessing nested data in grouped bar chart

I'm building a grouped bar chart by nesting a .csv file. The chart will also be viewable as a line chart, so I want a nesting structure that suits the line object. My original .csv looks like…
tgerard
  • 293
  • 3
  • 16
10
votes
2 answers

Group by identity in Ruby

How does Ruby's group_by() method group an array by the identity (or rather self) of its elements? a = 'abccac'.chars # => ["a", "b", "c", "c", "a", "c"] a.group_by(&:???) # should produce... # { "a" => ["a", "a"], # "b" => ["b"], # "c" =>…
sschmeck
  • 7,233
  • 4
  • 40
  • 67
10
votes
5 answers

SQL: Is it possible to 'group by' according to 'like' function's results?

I am using Oracle SQL and I want to group some different rows that 'like' function results. To elaborate with an example: Let's assume I have a table MESA with one of the columns is a huge string. And I am counting the number of rows matching…
someone
  • 381
  • 3
  • 5
  • 14
10
votes
3 answers

Get grouped comma separated values with linq

I would like a third column "items" with the values that are grouped. var dic = new Dictionary(); dic.Add("a", 1); dic.Add("b", 1); dic.Add("c", 2); dic.Add("d", 3); var dCounts = (from i in dic group i by i.Value into g …
Micah B.
  • 1,097
  • 4
  • 13
  • 27
10
votes
2 answers

Grouping Multiple Annotations

I have java 1.7. Is there any way to group multiple annotations to single one. So that i annotate with single annotation and gets all the properties of all grouped multiple annotations. I want to avoid multiple annotation lines repeated every…
Rahul
  • 295
  • 3
  • 14
10
votes
1 answer

Count, Sort and Group-By in Powershell

Are there any cool cmdlets that will help me do the following? I want something in Powershell that is as simple as doing the same in SQL: select RootElementName , count(*) from Table group by RootElementName order by RootElementName I'm all XML…
NealWalters
  • 17,197
  • 42
  • 141
  • 251
10
votes
4 answers

Java 8 grouping by from one-to-many

I want to learn how to use the Java 8 syntax with streams and got a bit stuck. It's easy enough to groupingBy when you have one key for every value. But what if I have a List of keys for every value and still want to categorise them with groupingBy?…
Mikael Grev
  • 587
  • 4
  • 12
10
votes
4 answers

PHP splitting arrays into groups based on equal values

I have an Array containing arrays with 2 values, the first one is the Number of the Author the second is his Affiliation. Array ( [0] => Array ( [0] => 2 [1] => Department of General Chemistry ) [1] =>…
user2419708
  • 133
  • 1
  • 1
  • 5
10
votes
1 answer

How to get length of current group in data.table grouping?

I know this can be achieved with other packages, but I'm trying to do it in data.table (as it seems to be the fastest for grouping). library(data.table) dt = data.table(a=c(1,2,2,3)) dt[,length(a),by=a] results in a V1 1: 1 1 2: 2 1 3: 3 …
jamborta
  • 5,130
  • 6
  • 35
  • 55
10
votes
2 answers

SQL Group By - Generate multiple aggregate columns from single column

I would like to group by Company & Date and generate count columns for 2 separate values (Flag=Y and Flag=N). Input table looks like this: Company Date Flag ------- ------- ----- 001 201201 Y 001 201201 N 001 201202 N 001 …
Thracian
  • 651
  • 4
  • 8
  • 24
10
votes
4 answers

awk extract multiple groups from each line

How do I perform action on all matching groups when the pattern matches multiple times in a line? To illustrate, I want to search for /Hello! (\d+)/ and use the numbers, for example, print them out or sum them, so for input abcHello! 200 300 Hello!…
Adrian Panasiuk
  • 7,249
  • 5
  • 33
  • 54