Question27 The Pandas DataFrame df is generated using the below code. import pandas as pddf=pd.DataFrame({'Salary':[50,100,75]}) Which option(s) can sort the DataFrame df by Salary column from top row being the lowest Salary to the last row being the highest Salary, and modify the DataFrame df directly? Select one or more alternatives: df.sort_values(by = 'Salary', ascending = False, inplace = True) df.sort_values(by = 'Salary', inplace = True) df.sort_values(by = 'Salary', ascending = True, inplace = True) df.sort_values(by = 'Salary') ResetMaximum marks: 3 Flag question undefined多项选择题
A
df.sort_values(by = 'Salary', ascending = False, inplace = True)
B
df.sort_values(by = 'Salary', inplace = True)
C
df.sort_values(by = 'Salary', ascending = True, inplace = True)
D
df.sort_values(by = 'Salary')
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
Question27 import pandas as pd df=pd.DataFrame({'Salary':[50,100,75]}) Which option(s) can sort the DataFrame df (defined as the above code) by the column Salary from lowest to highest and modify df directly? Select one or more alternatives: df.sort_values(by = 'Salary') df.sort_values(by = 'Salary', ascending = True, inplace = True) df.sort_values(by = 'Salary', ascending = False, inplace = True) df.sort_values(by = 'Salary', inplace = True) ResetMaximum marks: 3 Flag question undefined
Q14 I ran the code below and the df was unchanged. How can I make sure the sorting is applied to the df? df.sort_values(['date', 'storeid']) A: df.sort_values(['date','storeid'], inplace=True) B: df = df.sort_values(['date','storeid']) C: df.sort_index(['date','storeid'])
Assume the file "data_file.csv" exists and that it contains a column with the heading "age", and you run the following code snippet: import pandas as pd data = pd.read_csv("data_file.csv") sorted_data = data.sort_values(by="age") Which one of the following statements is TRUE?
Project A has a required return on 9.2 percent and cash flows of −$87,000, $32,600, $35,900, and $43,400 for Years 0 to 3, respectively. Project B has a required return of 12.7 percent and cash flows of −$85,000, $14,700, $21,200, and $89,800 for Years 0 to 3, respectively. Which project(s) should you accept based on net present value if the projects are mutually exclusive?
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!