[Solved] how to select from this table and add average value and then sort [duplicate]

select * from <your query> order by PERC wich : select * from ( select no, STUD_ID,CLASS,LESSON, AVG(PERC) as PERC,SUM(CNT) as CNT from t_lesson where LESSON=’CHEM’ group by CLASS union all select no,STUD_ID,CLASS,’AVERAGE’ as LESSON, AVG(PERC) as PERC, SUM(CNT) as CNT from t_lesson where LESSON=’CHEM’ group by LESSON ) as sub order by PERC DESC … Read more

[Solved] How to find average of a col1 grouping by col2 [duplicate]

With a data.frame named dat that looked like: rank name country category sales profits assets marketvalue 21 21 DaimlerChrysler Germany Consumer_dur 157.13 5.12 195.58 47.43 Try (untested d/t the numerous spaces in the text preventing read.table from making sense of it): aggregate(dat[ , c(“sales”, “profits”, “assets”, “marketvalue”)], # cols to aggregate dat[“country”], # group column … Read more

[Solved] how would i print all the names and scores of those users from a particular class?

Updating answer based on updated question: classdata = {} for data in schooldata: if classdata.get(data[‘class_code’]): classdata[data[‘class_code’]].append(data) else: classdata[data[‘class_code’]] = [data] print classdata To print class data (in orderly manner): for class_data in sorted(classdata): for person_data in sorted(classdata[class_data], key=lambda x: x[‘name’]): print person_data[‘class_code’], person_data[‘name’], person_data[‘score’] 15 solved how would i print all the names and scores … Read more