import pandas as pd grades_df = pd.DataFrame( data={'exam1': [43, 81, 78, 75, 89, 70, 91, 65, 98, 87], 'exam2': [24, 63, 56, 56, 67, 51, 79, 46, 72, 60]}, index=['Andre', 'Barry', 'Chris', 'Dan', 'Emilio', 'Fred', 'Greta', 'Humbert', 'Ivan', 'James'] ) if False: def convert_grades_curve(exam_grades): return pd.qcut(exam_grades, [0, 0.1, 0.2, 0.5, 0.8, 1], labels=['F','D','C','B','A']) print convert_grades_curve(grades_df['exam1']) print grades_df.apply(convert_grades_curve) def standardize(df): return None
import numpy as np import pandas as pd df = pd.DataFrame({ 'a': [4,5,3,1,2], 'b': [20,10,40,50,30], 'c': [25,20, 5, 15, 10] }) if False: print df.apply(np.mean) print df.apply(np.max) def second_largest(df): return None