I have the following data table and would like to look at each ticker value (there are 8032 unique types) and add the b_mkt (with the same TICKER) for each year and take the avg. I was wondering if there is a pandas method that would allow me to do that? Any help is much appreciated :)
Asked
Active
Viewed 25 times
0

Greasy Chicken
- 107
- 1
- 9
-
2`df.groupby(['DATE', 'TICKER'])['b_mkt'].agg(['sum', 'mean'])`? – ansev Mar 15 '20 at 19:57
1 Answers
0
That sounds like a groupby:
your_dataframe.groupby(['TICKER','DATE']).mean()
Edit: forgot brackets

E. Bassett
- 166
- 7