Questions tagged [aggregate]

Aggregate refers to the process of summarizing grouped data, commonly used in Statistics.

Aggregate refers to the process of summarizing grouped data, commonly used in Statistics. Typically this involves replacing groups of data with single values (e.g. sum, mean, standard deviation, etc.). In SQL databases and data manipulation libraries such as in , this is accomplished with the use of GROUP BY and aggregate functions.

Documentation:

8256 questions
2
votes
1 answer

Aggregate on multiple columns with one attribute at the agg function

Let's suppose that I have a pandas dataFrame (data_stores) similar to the following: store| item1 | item2 | item3 ------------------------------ 1 | 45 | 50 | 53 1 | 200 | 300 | 250 2 | 20 | 17 | 21 2 | 300 | 350 …
Outcast
  • 4,967
  • 5
  • 44
  • 99
2
votes
0 answers

Django - Update with Subqueries

I'm trying to update some "summary models" of my data without using a for loop. These summaries share many of the same field names as the data, so I feel like there should be an easy way to do some sort of…
Dr. Cyanide
  • 520
  • 1
  • 7
  • 21
2
votes
1 answer

How to $setDifference in array & Object using Mongo DB

UserDetails { "_id" : "5c23536f807caa1bec00e79b", "UID" : "1", "name" : "A", }, { "_id" : "5c23536f807caa1bec00e78b", "UID" : "2", "name" : "B", }, { "_id" : "5c23536f807caa1bec00e90", "UID" : "3", "name" :…
2
votes
2 answers

How to collapse a dataframe with duplicate IDs and varying missing values per ID, so that NAs are replaced by values from the duplicate ID? (in R)

I have a large dataframe where each value in the ID column represents a person. I want to collapse the dataframe so each ID (person) populates fewer rows (fewer duplicated IDs) but I only want to collapse the IDs if values missing in other columns…
2
votes
2 answers

How to adjust SQL aggregation by date query result to merge values in same level where nulls exist for some columns

Sorry for the messy title but here is my problem description. | id|dateKey|colA|colB|colD|colE| +---+-------+----+----+----+----+ | 1 |180111 | 1 | 5 |Null|Null| | 2 |180111 |Null|Null| 6 | 7 | | 3 |180111 | 2 | 5 | 3 | 2 | I have the…
BumbleBee
  • 129
  • 9
2
votes
0 answers

Unable to create nested json output (aggregated) from CSV input

Issue I am facing is I need aggregation of CSV inputs on ID, and it contains multiple nesting. I am able to perform single nesting, but on further nesting, I am not able to write correct syntax. INPUT: input { generator { id => "first" …
2
votes
4 answers

CLRSQL Aggregate function. LINQ Code works within CLR Function but cannot be deploy within Aggregate

Thanks for reading this, VS2010 against SQLServer2008 enterprise, developing CLR Aggregate function to calculate the MODE, the function is returning this error: "Line 1 CREATE AGGREGATE failed because type 'CMode' does not conform to UDAGG…
Peternac26
  • 51
  • 5
2
votes
1 answer

Excel: Aggregate formula with multiple (date) criteria and If-statement

I have a large list of clients that have an appointment on 4 different occassions (I call this Subjects): 1st Visit, 1st check up, 2nd check up and final visit. These clients are also linked to a partner: Kate, Dave, Bart, Will, John and Tom. From…
user10794258
2
votes
1 answer

SumoLogic:Can I have graph of min/max difference?

I want to show a graph of minimum value, maximum value and difference between maximum and minimum for each timeslice. It works ok for min and max | parse "FromPosition *)" as FromPosition | timeslice 2h | max(FromPosition) ,min(FromPosition) …
Michael Freidgeim
  • 26,542
  • 16
  • 152
  • 170
2
votes
2 answers

Aggregate data by year and override NA in row ONLY when value in column for that year

Suppose I have the data frame: dfTest <- data.frame(year = c(1,2,3,1,3), meanVal = c(1,2,3,1,3), var1 = c(1,2,3,1,3), var2 = c(NA,2,NA,1,3), var3 = c(1,NA,NA,1,3)) > dfTest year…
Ellie
  • 415
  • 7
  • 16
2
votes
2 answers

Sum values from multiple tables grouping by a common column

I have three tables in MS SQL Server 2014. Each of them holds a couple of numeric values, a description and a date. For the sake of brevety, let's assume the following tables: table "beverages" day beverage amount ---------- --------…
2
votes
1 answer

How to group on a column, array aggregate on another and create a single JSON object keyed by the grouped column

With this query and recordset: SELECT id, level FROM t; id | level ---------- 1 | a 2 | a 3 | a 4 | b 5 | b 6 | c 7 | c How to convert that to a JSON object, keyed by the level column and array aggregated on the id column? I don't…
Christiaan Westerbeek
  • 10,619
  • 13
  • 64
  • 89
2
votes
3 answers

DDD - Multiple Bounded Contexts because of differing aggregate data?

We try to split up our domain into bounded contexts with the goal to have a modular application design/architecture. We did an enlightening EventSorming session which helped us a lot to identify bounded contexts and its aggregates. After the…
2
votes
2 answers

GROUP BY one field, keeping other fields

Base table bod with three fields: | BOFORM_ID | FEINBOD | MAECHTBOD | +-----------+---------+-----------+ | 3301211 | fSms | 50 | | 3301211 | mSfs | 150 | | 3301231 | fSms | 200 | | 3301312 | Ss | 150…
TVolt
  • 83
  • 1
  • 5
2
votes
2 answers

sum values in dictionary less than a certain value

I have the following dictionary and am trying to make a pie chart from them but I want to only include the top 5 (they are already sorted by value here) and then sum the others together in an Other category i.e. replace Publishing, Fashion, Food…