3,475 questions
3
votes
1
answer
77
views
How to pass argument to func in `pandas.resampler.agg()` when using dict input?
I am trying to resample a pandas dataframe, and for some columns I would like to sum on. additionally, I want to get None/nan as result when there is no rows in a resampling period. For aggregation on ...
-1
votes
1
answer
55
views
Column-wise aggregation of array vectors :calculating mean per “level” for bid/ask data
I am currently working on a data analysis task in DolphinDB where I need to perform column-wise aggregation on array vectors that store level - 10 bid/ask data. Specifically, I have data for bid ...
1
vote
1
answer
107
views
How to prevent duplicate transaction calculations in a ClickHouse materialized view
I’m planning to use ClickHouse to calculate wallet balances based on transactions in my base table. However, there’s an issue: if something goes wrong and I end up inserting the same transactions into ...
0
votes
1
answer
141
views
How to sum two columns and calculate their average in BigQuery?
I'm working with Google BigQuery and I have a table with two numeric columns: grade1 and grade2. I want to calculate the total sum of both columns combined (row-wise) and then find the average of ...
2
votes
1
answer
135
views
Pyspark aggregations optimization
I have a huge dataframe with 3B rows. I'm running the PySpark code below with the Spark config.
spark = SparkSession\
.builder\
.appName("App")\
.config("spark....
0
votes
0
answers
79
views
PySpark aggregations fail
I have a PySpark dataframe that contains 100M rows. I'm trying to do a series of aggregations on multiple columns, after a groupby.
df_agg = df.groupby("colA","colB","colC&...
5
votes
2
answers
174
views
Simpler forwarding of contained object
I have a proprietary file format definition that contains a header format:
class Header
{
public:
uint32_t checksum;
uint16_t impedance;
uint16_t type_of_data;
uint32_t ...
1
vote
1
answer
140
views
How do I use a drop down to change field in Vega visualization
In Vega or Vega lite, I want to create a stacked area chart where I can change the field used to color the visualization. Here is an example visualization. In this example, I would like to be able ...
2
votes
1
answer
82
views
Problems refactoring pandas.DataFrame.groupby.aggregate to dask.dataframe.groupby.aggregate with custom aggregation
I would like to run groupby and aggregation over a dataframe where the aggregation joins strings with the same id.
The df looks like this:
In [1]: df = pd.DataFrame.from_dict({'id':[1,1,2,2,2,3], '...
2
votes
2
answers
150
views
Does a multiplicity of 0..* always require a reference in the form of an instance variable?
I have modeled the relationship between LeaseAgreement and Person as an aggregation. The '1' on the Person side is meant to indicate that each LeaseAgreement has exactly one reference to a Person (in ...
0
votes
2
answers
125
views
Using StringAgg after filter & distinct
I'm using StringAgg and order as follows:
# Get order column & annotate with list of credits
if request.POST.get('order[0][name]'):
order = request.POST['order[0][name]']
...
0
votes
0
answers
54
views
Average aggregation of data stream in bytewax
I want to aggregate the values of my DataStream in tumbling windows of 10 seconds.
Unfortunately is the documentation in Bytewax very limited and I also don't find any other source where an average of ...
0
votes
0
answers
70
views
Running OpenSearch term aggregations in parallel
We have a query calculating number of terms on multiple fields.
{
"query": {
"bool": {
"filter": [
{
"term": {
"...
4
votes
2
answers
241
views
How to represent a Map<Enum, Class> relationship in a UML class diagram? [closed]
I have a class Car, an enum Position, and a class Wheel. In Car, I have a map attribute:
private Map<Position, Wheel> wheels;
I want to represent this structure in a UML class diagram. My ...
0
votes
1
answer
108
views
Masked aggregations in pytorch
Given data and mask tensors are there a pytorch-way to obtain masked aggregations of data (mean, max, min, etc.)?
x = torch.tensor([
[1, 2, -1, -1],
[10, 20, 30, -1]
])
mask = torch.tensor([
...
2
votes
2
answers
80
views
'Directed Association' is uno-directional Aggregation & uno-directional Composition. Change my mind
I am learning about UML-Class-Diagram and I have come across directional association. After long hours of research, I became insane because everyone is explaining it differently and there is only an ...
2
votes
2
answers
79
views
Pandas groupby multiple columns, aggregate some columns, add a count column of each group [duplicate]
The data I am working with:
data (140631115432592), ndim: 2, size: 3947910, shape: (232230, 17)
VIN (1-10) object
County ...
0
votes
1
answer
90
views
How to customize column names while grouping and aggregating?
I have a dataframe which has the following columns:
region_id, name, parent, parent_name, t2m, d2m, and tp.
I want to group and aggregate column values in a specific way. To enable that, I have ...
-3
votes
1
answer
77
views
Monthly data aggregate to years in excel pivot table
I have a dataset of usage data per account, with multiple usage metrics for four years represented monthly as 'Jan.21'. I need yearly aggregates in columns in pivot table. Columns: 'Account name', '...
0
votes
0
answers
44
views
MongoDB Aggregation Pipeline Performance Optimization for Latest User Tracking (4M+ Records)
Problem: I have a MongoDB collection TrackingReport with 4 M+ records (expected to grow to billions) that stores user location tracking data. I need to get the latest tracking record for each user ...
0
votes
1
answer
72
views
Kibana - Attempting to use Nested Aggregation in a condition in a Watcher
In Kibana Watcher, I'm trying to use the average results from a nested aggregation of a bucket on a condition within a Kibana Watcher but getting an null reference error when running a simulate on the ...
0
votes
0
answers
67
views
Approach needed for filtering aggregated data in Laravel / MySQL 8
I'm hoping someone can point me in the right direction here or share some approaches to a challenging feature I need to implement in my Laravel 11 project.
I have a model called StatisticAggregate ...
0
votes
0
answers
69
views
How to parse a 'COMPLEX<serlializablePairLongString>' in order to get only the String result from the query in Apache Druid?
I have a table definition in Apache Druid with a column as a complex type COMPLEX<serializablePairLongString> created by an ingestion aggregation.
So the column data is displayed like:
column
...
0
votes
1
answer
74
views
Mudblazor Datagrid aggregations are not aligned with parent column
I recently upgraded Mudblazor version from 7.15.0 to 8.0.0-preview.6 and then in all components where Data grid was used, aggregation part was shifted.so I had to downgrade to previous version. A ...
1
vote
1
answer
41
views
Sales data aggregation in R
I have daily sales data for multiple products in three stores. It looks something like this:
item_id
store_id
category_id
dept_id
date
event_name
daiy_price
a
tx_1
food
1
2012/12/24
6
a
tx_1
food
1
...
1
vote
2
answers
59
views
Why does this INNER JOIN query return all rows instead of just the one matching?
CREATE TABLE EMPLOYEE (
empId INTEGER AUTO_INCREMENT PRIMARY KEY,
name TEXT NOT NULL,
dept TEXT NOT NULL
);
INSERT INTO EMPLOYEE(name, dept) VALUES ('Clark', 'Sales');
INSERT INTO EMPLOYEE(name,...
-2
votes
1
answer
56
views
Looking for help to aggregating user orders data [closed]
I have an aggregation use case where I have a large JSON containing product orders data that I need to aggregate.
Below is a small subset of the data which I am planning to aggregate and seek your ...
0
votes
1
answer
18
views
How to get unique field values based on recent and highest priority documents in Elasticsearch?
I have an Elasticsearch index that stores documents with the following fields:
timestamp (date)
priority (integer)
user_id (string)
I need to find 5 unique user_id values from the most recent and ...
-1
votes
1
answer
84
views
Atlas Search across Enbedded Document and Root Document fields using Compound/Must
How do I perform a “Compound/Must” across EnbeddedDocument and RootDocument fields?
Ive create a playground for this issue im facing
https://search-playground.mongodb.com/tools/code-playground/...
1
vote
0
answers
63
views
MongoDB Aggregations: Why is $group slow with indexed string fields but not on date?
Setup
Imagine this document shape:
{
dateString: "2024-10-31", // type string
realDate: ISODate("2024-10-31"), // type date
}
Assume both fields are indexed separately.
...
0
votes
1
answer
85
views
How to use Atlas Search Compound "Must" aggregation to seach Root Document fields AND EmbeddedDocument fields
I have the below document
{
"_id": "101",
"PublisherName": "Big book publishers",
"PublisherAddress": "123 Mian Street",
&...
0
votes
1
answer
134
views
How to search embeddedDocuments fields and Root Document fields using Atlas Search
I have the following document in my collection
{
"_id": "101",
"PublisherName": "Big book publishers",
"Books": [
{
&...
0
votes
0
answers
192
views
Apache Camel - Split, Tokenize and Aggregate not completing when using exchange-factory pooled
I'm having an issue with an Apache Camel route after migrating to version 4.6.0. The problem is that the exchange is never set to done when exchange-factory is pooled instead of default value ...
-1
votes
1
answer
77
views
Why SQL HAVING SUM(column) comparison with number does not work? [closed]
Try to find the continents where all countries have a population <= 25000000 from the world table below as in Difficult Questions That Utilize Techniques Not Covered In Prior Sections.
name
...
1
vote
2
answers
62
views
how do you select the maximum value accross each row in pandas
Hi have this data frame:
Server 1-Jun 6-Jun 1-jul Jul-10
ServerA 8 9 5 90
ServerB 100 10 9 90
I need to create another column called maximumval and pick ...
0
votes
1
answer
549
views
Is it possible to aggregate grouped rows in AG Grid?
Some context:
I'm working on a React.js frontend app, using the AgGridReact component. I've managed to get various custom aggregations working, default aggs working, etc. In a typical scenario like ...
-3
votes
1
answer
90
views
Sum up Week to Date values in a versatile manner - Pandas
So every day I have to pull a report that gets data for yesterday's metrics, forecasted Saturday's metrics, and Week to date sums.
I want to write a Python code that automates the process.
I have most ...
0
votes
0
answers
86
views
MongoDB Aggregation to calculate total revenue by each store for each month
I have a collection named sales with documents structured as follows:-
{
"_id": ObjectId("..."),
"date": ISODate("2024-06-15T00:00:00Z"),
"store": &...
0
votes
1
answer
322
views
Facet Atlas Search returning the $$SEARCH_META using C# MongoDB.Driver
I would like to do a Facet Search that returns the "$$SEARCH_META" based on the documentation (https://www.mongodb.com/docs/atlas/atlas-search/facet/). A snippet of the search definition ...
0
votes
1
answer
61
views
How to sum by date for a list of items
I use MongoDB version 7. I store the payments data with order and buyer information. I have a few payments in a collection with order and buyer information, which I group by order id to the next JSON ...
0
votes
0
answers
20
views
Spring Integration Aggregator (5.5.19) is not aggregating all responses correctly, and then releases partial group
I have an application where I am using integration splitter to split messages and created list of messagges and send them out for processing.
When response is received individually for aggregation ...
0
votes
0
answers
39
views
Populate a ObjectId deep nested inside arrays and objects preserving document shape
I'm using MongoDB v5 with NodeJS (no Mongoose).
Let's say I have a collection structured the following way. This specific setup (an ObjectId nested inside an object contained inside an array contained ...
1
vote
1
answer
35
views
Can I create a composite index with a field name in URL format?
We are currently developing a large data transfer process through mongodb and spring.
I created a composite index using compass, but it is not actually used.
It seems that the field name is in Url ...
-2
votes
1
answer
53
views
Count rows from combining two tables [closed]
What Postgres query can I use for the below scenario?
Parent table:
Child table:
Expected result
Explanation:
Parent1 --> 4 equipments. Parent1 has ...
Child1 holding 3 equipment
Child2 holding ...
1
vote
1
answer
52
views
Aggregate values of XML tags via SQL query
I need to aggregate some sub-tag values into a Oracle SQL column.
Let's say the XML structure is something like this:
<Product>
[..other tags..]
<Attributes>
<Statements Id="1&...
0
votes
0
answers
52
views
MongoDB server side pagination with lookup, inner join and limit
Data:
I have MongoDB setup to hold information about different devices. Each device can contain multiple nodes which have parent-child relationship. Each device can be applicable to multiple platforms ...
0
votes
0
answers
64
views
How to use facet on Mongo aggregation
I am able to execute mongo query on mongo compass with below aggregation but I am not able to execute and get same result on Spring boot application
[
{
$match: {
$and: [
{
...
2
votes
0
answers
172
views
Complex groupby aggregation with cartesian product of multi-dimensional data over ManyToMany field
I have the following problem with a complex aggregation in postgres (16). The datamodel (CREATE Statements and ER-diagram) and an example of the required result set are to be found under the question.
...
0
votes
0
answers
76
views
Joining 10 Collections in MongoDB
I encountered the following scenario: I’m doing an aggregation for the MasterCollection collection. I’m “joining” this collection with other 9 collections in the aggregation.
In the end, I’m merging ...
0
votes
1
answer
35
views
Add a field inside an array within a MongoDB object, with values computed dynamically based on other values inside the same nested array
I have a simple MongoDB array of objects with this structure:
[
{
"_id": {
"$oid": "6688c2f6b79f2bfefb751d5f"
},
"date": "06/07/2024&...