【发布时间】:2022-12-11 01:05:31
【问题描述】:
上述问题的解决方案是什么?
Given a dataframe, you have to sort the rows based on values of one column.
Note: Sorting should be in descending order of values of given column
The input will contain a column name. The output should contain the first five rows of the dataframe.
The output will contain the first n rows of the sorted dataframe.
Sample Input:
TOEFL Score
Sample Output:
Serial No. GRE Score TOEFL Score University Rating SOP LOR CGPA \
25 26 340 120 5 4.5 4.5 9.60
97 98 331 120 3 4.0 4.0 8.96
81 82 340 120 4 5.0 5.0 9.50
202 203 340 120 5 4.5 4.5 9.91
203 204 334 120 5 4.0 5.0 9.87
Research Chance of Admit
25 1 0.94
97 1 0.86
81 1 0.96
202 1 0.97
203 1 0.97
Execution Time Limit
将熊猫导入为 pd 列=输入() df=pd.read_csv("https://media-doselect.s3.amazonaws.com/generic/RM8r5NBrJdA4QeVZXvwbjokwv/Admission_Predict.csv") #在这里写你的代码 排序 = pd.DataFrame.sort_values(by="col", axis=0, ascending=False) 打印(排序)
【问题讨论】:
标签: python pandas dataframe numpy