Mar-29-2017, 08:39 PM
I hope you are all having a good day. I have a DataFrame named df with 9 variables and 99,492 observations. I am trying to create to create a variable with the counts of all the other variables aggregated by month. Why does the first code not work:
df['bymonth']=df.groupby('Month').count()
But the following code does work:
bymonth=df.groupby(‘Month’).count()
df['bymonth']=df.groupby('Month').count()
But the following code does work:
bymonth=df.groupby(‘Month’).count()