Questions tagged [group]
585 questions
1
vote
2 answers
Drop rows in pandas dataframe depending on order and NaN
I am using pandas to import a dataframe, and want to drop certain rows before grouping the information.
How do I go from the following (example):
Name1 Name2 Name3
0 A1 B1 1
1 NaN NaN 2
2 NaN NaN 3
3 NaN B2 4
4 NaN NaN 5
5 …

chrundle
- 13
- 3
1
vote
1 answer
How to more + rotate 180 degree + move a group of shape using Processing?
I'm having this Processing issue where I'm trying to make my ariplane do a 180 turn-over right before it gets to the end of the drawing... It looks fairly simple but I just can't get it to work. Help would be much appreciated.
As I have other…

Vincent Fortier
- 35
- 4
1
vote
1 answer
How to group at the for loop through the second condition
unfortunately I'm having trouble creating a correct display of mianowiecie values.
I have such a DF:
Group
Match
Team
A
1
A1
A
1
A2
A
2
A3
A
2
A4
I have this code:
for group in set(world_cup['Group']):
print('___Starting group…

Kon Wes
- 19
- 3
1
vote
1 answer
1
vote
0 answers
If we group by multiple columns but want distinct column values in one of the column
If we have a table named Employees which contains columns emp_name, dept_name, year and salary.
Following are the row headers and values:
(emp_name, dept_name, year, salary)
(Nick, sales, 2020, 20000),
(Peter, …

user20534765
- 11
- 2
1
vote
4 answers
Group values for groupby().mean()
Have a Dataframe:
Column_A
Column_B
1
20
2
25
1
52
2
22
4
67
1
34
3
112
5
55
4
33
5
87
1
108
Looking to create 2 groups from Column_A, and find the average of those groups in Column_B:
So first group might be 1, 2 and…

MB2000
- 13
- 3
1
vote
0 answers
Rails: How to include zeros in a group count query?
I'd like to include zeros in a count.
Here is my query for my count:
@hammer_counts = current_user.tools.where(shed_id: @sheds.pluck(:id)).joins(:hammer, :user).group(['hammers.name', 'users.first_name']).count
This gives me the following…

DaveC
- 59
- 1
- 8
1
vote
0 answers
How to do multiple table JOIN, GROUP and DISTINCT COUNT with LinQ?
I have three tables as follows:
create table project_model(
id int auto_increment primary key,
name varchar(100) not null
);
create table project_model_phase(
id int auto_increment primary key,
mid int not null,
name varchar(100) not…

user2182284
- 11
- 3
1
vote
1 answer
AttributeError: 'Group' object has no attribute 'collide' Pygame
I'm creating a basic simulation in pygame and my object (an amoeba represented by a green square on the screen) has two methods. My update method is running fine, but the collide method is giving my an attribute error. By the way, since I have added…

AtomProgrammer
- 245
- 3
- 13
1
vote
2 answers
Pandas: start a new group on every non-NA value
I am looking for a method to create an array of numbers to label groups, based on the value of the 'number' column. If it's possible?
With this abbreviated example DF:
number = [nan,nan,1,nan,nan,nan,2,nan,nan,3,nan,nan,nan,nan,nan,4,nan,nan]
df =…

user3316115
- 75
- 1
- 7
1
vote
1 answer
Counting group size including zero with R's data.table
I have a small (< 10M row) data.table with a variable that takes on integer values. I would like to generate a count of the number of the number of times that the variable takes on each integer value, including zeroes when the variable never takes…

Michael Lachanski
- 57
- 7
1
vote
0 answers
How to view Google Groups access logs?
We are using Google Workspace Enterprise Standard plan for our company emails. Recently we found out that in some of our groups the "conversation history" setting was set to "on" and the "who can view conversations" setting was set to "entire…

Alper K. Tunç
- 51
- 7
1
vote
1 answer
Match positive to negative values based on datetime distance
See the image below:
I want to match each positive stem above the red dashed line to the closest negative stem below the red line. This match is done on how much time the stems lie away from each other. So stem A will be matched to stem B. A…
1
vote
1 answer
Using for loop to take several columns from dataset
I'm inexperienced with for loops and try to write for loop in R for several columns from a df dataset. Each column I'm interested in has values from 1 to 15 or NA. "names" is a list of names of those columns:
>names
[1] "score" "rate" "asset" …

Bambeil
- 309
- 1
- 8
1
vote
1 answer
Making a CSV file into a hash and then grouping by criteria
In ruby, if I have a CSV file that looks like this:
make,model,color,doors
dodge,charger,black,4
ford,focus,blue,5
nissan,350z,black,2
mazda,miata,white,2 …

burner
- 73
- 4