Questions tagged [group]
585 questions
9
votes
5 answers
Django Admin - Giving staff members access to certain areas by default
Could anyone tell me how to give staff users in django (those with is_staff set to true) access to some models by default in the admin interface? Currently if I log in as a staff member I just get "You don't have permission to edit anything". If I…

hajamie
- 2,848
- 2
- 22
- 20
5
votes
5 answers
Is there a better R way to expand a dataframe by a function on rows?
Question:
Below works, but is there a better "R way" of achieving similar result? I am essentially trying to create / distribute groups into individual line items according to a user defined function (currently just using a loop).
Example:
df1 <-…

ScottyJ
- 945
- 11
- 16
5
votes
1 answer
adjust the elements of a column to get a cumsum equal to zero
I have this columns in a bigger dataset (here i just report asset "x" but there are different, hence the idea is to replicate the process for every asset):
df <- structure(list(
asset = c("x", "x", "x", "x", "x", "x", "x", "x", "x", "x",…

Lorenzo Mazzucchelli
- 121
- 6
4
votes
2 answers
How to shrink/filter data per group?
I have a dataset with some columns and a grouping variable. I want to reduce the dataset per grouping variable, max_n rows per grouping level. At the same time I want to keep the distribution of the other columns. What I mean by that is that I want…

EnFiFa
- 43
- 5
4
votes
3 answers
Group manually entered date values depending on whether they are continuously the same over system log dates
Example Situation: An order system tracks manually entered due dates by recording a system log date that is always unique (this would be a datetime, but I've used dates for simplicity).
I would like to assign a group or section to each due date…

jn4248
- 105
- 5
4
votes
2 answers
R, find average length of consecutive time-steps in data.frame
I have the following data.frame with time column sorted in ascending order:
colA=c(1,2,5,6,7,10,13,16,19,20,25,40,43,44,50,51,52,53,68,69,77,79,81,82)
colB=rnorm(24)
df=data.frame(time=colA, x=colB)
How can I count and take the average of the…

aaaaa
- 149
- 2
- 18
- 44
3
votes
1 answer
Grouping of grouped results in mongoDb
I apologize if the title is not precise enough, I'm not sure how to describe my problem better.
I have the following data:
Category: A, Group: 1
Category: A, Group: 1
Category: A, Group: 2
Category: A, Group: 3
Category: B, Group: 5
Category: B,…

Ptros
- 41
- 2
3
votes
3 answers
How to combine consecutive N groups to one group each repetitive
I have this tibble with 8 groups:
df <- structure(list(group1 = c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6,
6, 7, 8, 8)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-16L))
group1
1 1
2 1
3 2
4 2
5 …

TarJae
- 72,363
- 6
- 19
- 66
3
votes
3 answers
Split and group values in excel
Hi I have a column of values which has different suffix after a dot, i need it to group it based on the value after dot. Example i need to split all values that end with .pdf into one column, values with.xls as another column, etc,,,
how to do this…

N S
- 91
- 7
3
votes
2 answers
Calculate means including all factor levels but one
Using the dataframe mtcars I would like to add the column qsec_control which is calculated as the mean(qsec) of all rows that don't have the same cyl as the current row (e.g. if cyl == 6, it would take mean(qsec[cyl != 6])).
The question feels…

Skywooo
- 87
- 6
3
votes
3 answers
Nextflow input how to declare tuple in tuple
I am working with a nextflow workflow that, at a certain stage, groups a series of files by their sample id using groupTuple(), and resulting in a channel that looks like this:
[sample_id, [file_A, file_B, ... , file_N]]
[sample_id, [file_A, file_B,…

schmat_90
- 572
- 3
- 22
3
votes
4 answers
Group similar strings with numbers and keep order of first appearance
I have a dataframe which looks like this example (just much larger):
var <- c('Peter','Ben','Mary','Peter.1','Ben.1','Mary.1','Peter.2','Ben.2','Mary.2')
v1 <- c(0.4, 0.6, 0.7, 0.3, 0.9, 0.2, 0.4, 0.6, 0.7)
v2 <- c(0.5, 0.4, 0.2, 0.5, 0.4, 0.2, 0.1,…

Mina
- 117
- 7
3
votes
1 answer
Keycloak "Advanced Claim To Group" identity provider mapper example
I am using Keycloak 18.0.2. Okta is one of my configured Identity Providers. I am using the OIDC provider (not SAML). I want to map the incoming groups claim from Okta to a user group I defined in Keycloak. I cannot find a lot of examples on how to…

AnnaSarteNicotera
- 71
- 7
3
votes
2 answers
R group columns of return trips data
I have data of train trips and the number of delayed or cancelled trains that I would like to make the sum.
Start End Delayed Cancelled
Paris Rome 1 0
Brussels Berlin 4 6
Berlin Brussels 6 2
Rome …

hug
- 247
- 4
- 14
2
votes
3 answers
How to sort and group on column using pandas loop
from a data frame
df1 =
Area
Sequence
X
Y
A
2
604582.25
320710
A
1
604590.25
320704.75
A
3
604579.25
320710
B
2
536584.47
176977.83
B
1
536570
176996.43
C
1
509202.13
307995.99
C
2
509205.3
307951.24
Need to generate into
df1…