Questions tagged [group]
585 questions
2
votes
3 answers
Assign GROUP_ID to rows based on start/end tags
I have an Oracle 18c table called LOGS:
create table logs (id number, log_tags varchar2(4000));
insert into logs (id, log_tags) values ( 1,'

User1974
- 276
- 1
- 17
- 63
2
votes
1 answer
How to select user_id rows pandas
How can I calculate the first visited date and the last visited date before an order was placed by the user?
USER ID TYPE DATE
1 Visited September 14, 2020
1 Visited October 4, 2020
1 Visited October 24, 2020
1 Ordered November 1, 2020
2 …

Blogger22
- 23
- 5
2
votes
1 answer
GroupBy, output certain amount (.Take(n)) and combine rest
I have made a Linq query where I am grouping by calls and summing duration and everything is working according to expectations. However problem is, that I am getting too many results as an output. After grouping I would like to get lets say maximum…

10101
- 2,232
- 3
- 26
- 66
2
votes
2 answers
Linear regression per group in Julia
To do a linear regression in Julia we can use the function lm like this:
using DataFrames
using GLM
df = DataFrame(x=[2,3,2,1,3,5,7,4,2],
y=[2,3,5,1,5,6,4,2,3])
9×2 DataFrame
Row │ x y
│ Int64 Int64…

Quinten
- 35,235
- 5
- 20
- 53
2
votes
1 answer
How to use dumpdata and loaddata for Django Groups with some permissions?
While writing testcases, I required fixtures or we can say json data to pre-populate database. I have a project which is using Django Groups and Permissions models.
Now, when I use command for dump data python manage.py dumpdata auth.Groups >…

Parth
- 101
- 1
- 6
2
votes
1 answer
How to count cumulative unique values by group?
I wonder how to count accumulative unique values by groups in python?
Below is the dataframe…

leilei
- 37
- 5
2
votes
3 answers
In pandas how to create new column from observations and aggregate values from another column
I have this dataframe and I want to transform it into another dataframe with a column which combines observations from several columns in the first dataframe and aggregates values from the column "points". Here's the dataframe and below is the…

Yordanka Stefanova
- 23
- 4
2
votes
1 answer
Sequelize.js : Sum with condition and group by
I'm a biginner using Sequelize.
I spend hours trying to get the following code runs but I can't
I quit some columns from the table for better understanding.
Finance table
I want to get this result:
[
{
'month': 11,
'year': 2021,
…

AleOjeda
- 38
- 5
2
votes
2 answers
Add a animated sprite to phaser objects
I have the following code in phaser, and I want to use a sprite animation instead of a static image, how can I pull that off? Using group to create new bullets.
I am creating a new object and with that creating new bullets to get fired by the…

Filipe Cruz
- 81
- 1
- 10
2
votes
2 answers
SQL Snowflake Min Date For Each Record & Group By Month
I am using Snowflake to get some information from the data. I have a table in which the same employee (PRS_ID) can be included in many rows and I want to take the EARLIEST date (BGN_DATE) for each employee (PRS_ID). Next, I want to see how many…

MarekMarek
- 23
- 7
2
votes
2 answers
group_by_month(:date).select() not giving date value in the desired output
I am using the following code to group my active record relation by month. But as I extract attributes, I do not know how to get the date value as well.
This is my code:
books.group_by_month(:date).select("COUNT(*) as total, SUM(first_attribute) as…

Sayan Patel
- 39
- 4
2
votes
2 answers
Assign rows to groups of 3 in data frame?
I have the following data frame:
id
A
A
A
A
A
B
B
B
B
B
B
C
C
I want to create another column called "Group.3". In this column, the number of rows per group are counted in threes. 3…

Cam
- 449
- 2
- 7
2
votes
1 answer
Is it possible to group by company when computing different technical indicators from the TTR package in R?
I am trying to compute various technical indicators that will be used to predict the stock price movement of around 100 stocks. For example, I want to calculate the Average True Range (ATR) for each of the companies in my time series, which I am…

hellberg30
- 33
- 5
2
votes
3 answers
Group persons based on birth of year in R
I have the following dataset
df<- data.frame(x1=c(1,5,7,8,2,2,3,4,5,10),
birthyear=c(1992,1994,1993,1992,1995,1999,2000,2001,2000, 1994))
I want to group persons in 3-year intervals together so that persons born in 1992-1994 are group 1 and…

ZayzayR
- 183
- 9
2
votes
1 answer
How to apply a statistical test to several columns of a dataframe in R
I want to apply this test, not only to column x1, as I do in this example, but to several columns of df. In this case x1 and x2.
I tried to put this code inside a function and using purrr::map but I can't do it right.
library(tidyverse)
df <-…

sbac
- 1,897
- 1
- 18
- 31