@@ -5159,66 +5159,34 @@ def lookup(self, row_labels, col_labels) -> np.ndarray:
51595159 --------
51605160 >>> grades = pd.DataFrame(
51615161 ... {
5162- ... "Math_Sem1": [85, 92, 78, 88, 95],
5163- ... "Math_Sem2": [88, 90, 82, 85, 93],
5164- ... "Science_Sem1": [90, 85, 92, 79, 87],
5165- ... "Science_Sem2": [92, 87, 90, 83, 89],
5166- ... "English_Sem1": [95, 80, 85, 90, 82],
5167- ... "English_Sem2": [93, 82, 87, 88, 80],
5162+ ... "Math": [85, 92, 78, 88, 95],
5163+ ... "Science": [90, 85, 92, 79, 87],
51685164 ... },
51695165 ... index=["Alice", "Bob", "Charlie", "David", "Eve"],
51705166 ... )
51715167 >>> feedback = pd.DataFrame(
51725168 ... {
5173- ... "Math_Sem1 ": [
5169+ ... "Math ": [
51745170 ... "Strong analytical skills",
51755171 ... "Excellent problem-solving",
51765172 ... "Needs more practice",
51775173 ... "Solid understanding",
51785174 ... "Exceptional reasoning",
51795175 ... ],
5180- ... "Math_Sem2": [
5181- ... "Improved advanced techniques",
5182- ... "Consistent high performance",
5183- ... "Significant progress",
5184- ... "Steady improvement",
5185- ... "Consistently exceptional",
5186- ... ],
5187- ... "Science_Sem1": [
5176+ ... "Science": [
51885177 ... "Excellent inquiry skills",
51895178 ... "Good theoretical concepts",
51905179 ... "Strong methodological interest",
51915180 ... "Needs focus",
51925181 ... "Outstanding curiosity",
51935182 ... ],
5194- ... "Science_Sem2": [
5195- ... "Advanced scientific principles",
5196- ... "Improved practical skills",
5197- ... "Growing scientific reasoning",
5198- ... "Better lab engagement",
5199- ... "Continued excellence",
5200- ... ],
5201- ... "English_Sem1": [
5202- ... "Exceptional writing",
5203- ... "Strong language use",
5204- ... "Needs confident expression",
5205- ... "Solid literary analysis",
5206- ... "Creative insights",
5207- ... ],
5208- ... "English_Sem2": [
5209- ... "Refined writing techniques",
5210- ... "Improved expression",
5211- ... "More confident analysis",
5212- ... "Developing writing style",
5213- ... "Maintained high-level writing",
5214- ... ],
52155183 ... },
52165184 ... index=["Alice", "Bob", "Charlie", "David", "Eve"],
52175185 ... )
52185186 >>> student_top = grades.rank(1).idxmax(1) # student's top score
52195187 >>> feedback.lookup(student_top.index, student_top)
5220- array(['Exceptional writing ', 'Excellent problem-solving',
5221- 'Strong methodological interest', 'Solid literary analysis ',
5188+ array(['Excellent inquiry skills ', 'Excellent problem-solving',
5189+ 'Strong methodological interest', 'Solid understanding ',
52225190 'Exceptional reasoning'], dtype=object)
52235191 """
52245192 n = len (row_labels )
0 commit comments