Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+13 votes

I'm trying to clean one of my dataframe and need help grouping it by the attributes of a given column. What I've found online hasn't helped so far. Right now my line of code follows the pattern:

df.groupby('column1')

I also tried square brackets around my column name inside the parentheses and neither one is grouping the attributes. The resulting DataFrame is unchanged. Does anyone know the fix for this?

asked in DATA360_Spring2019 by (1 point)

1 Answer

+6 votes
 
Best answer

I had the same sort of issue for a general groupby commands. However I also applied a function in part of my groupby command which sorted it fine. I am not sure exactly what you are looking to group it by or the purpose, but my code was along the lines of:

df.groupby('column name').mean()['column 2 name']

answered by (1 point)
selected by
...