Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Data Science by (18.4k points)

How to find an average of the column3 to 10 for A, B,... Z?

#column #column2  #column3....#column10

A,        2010,     1231

A,        2011,     1235

A,        2012,     1233

A,        2014,     1234 

A,        2015,     1231

B,        2010,     1423

B,        2011,     1423

1 Answer

0 votes
by (36.8k points)

I am assuming that this table you're using is the panda's data frame. Let us say that name of each data frame is df and that name of that first column is 'column 1'. I have used the first column because that is someone that contains values - A,B,---Z. The following code should help you out.

import pandas as pd

df.groupby(['column_name']).mean()

Do you wish to learn Data Science from scratch? Enroll in this Data Science Courses

 

Browse Categories

...