2024-09-30 22:14:21 发布
网友
我们要对“名字”进行分类,同时确保给正确的学生适当的分数。你知道吗
print("List of grades are:") grraids=computeFinalGrade(pure_data) kn=np.column_stack((names,grraids)) for names in sorted(kn): print(kn)
我们得到了,但非常希望这些名字是在alphebetic顺序,但保持功能一般。你知道吗
编辑:抱歉,没有意识到这是一个numy数组,代码已经相应地更改。然而,它仍然假设学生的名字总是在同一个地方。(第一个点)
import numpy as np grades = np.array([["B",10],["C",8],["A",3]]) print grades grades.sort(axis=0) print grades
输出:
[['B' '10'] ['C' '8'] ['A' '3']] [['A' '10'] ['B' '3'] ['C' '8']]
编辑:抱歉,没有意识到这是一个numy数组,代码已经相应地更改。然而,它仍然假设学生的名字总是在同一个地方。(第一个点)
输出:
相关问题 更多 >
编程相关推荐