"The solution produces the same result as the 'prescribed solution' yet it does not get accepted In the test results section
transcript['year'] = transcript['year'].astype(str)
df = pd.pivottable(data = transcript, index = 'studentid', columns = 'year', values = 'yearlygpa', aggfunc = 'mean').resetindex()
df = df[(df['2021'] < df['2022']) & (df['2022'] < df['2023'])]
df['average_gpa'] = df[['2021', '2022', '2023']].mean(axis=1).round(2)
return df
"
Prachi G. - "The solution produces the same result as the 'prescribed solution' yet it does not get accepted In the test results section
transcript['year'] = transcript['year'].astype(str)
df = pd.pivottable(data = transcript, index = 'studentid', columns = 'year', values = 'yearlygpa', aggfunc = 'mean').resetindex()
df = df[(df['2021'] < df['2022']) & (df['2022'] < df['2023'])]
df['average_gpa'] = df[['2021', '2022', '2023']].mean(axis=1).round(2)
return df
"See full answer
"The question is incomplete --- the code only passes if you return the data frame sorted by BOTH department name AND rank. While in the problem description, it mentions to only rank by department name: "The results should be ordered by department name."
Not a big difference I know, but students shouldn't need to look into the solution to get the necessary knowledge to answer the question."
Chao peter Y. - "The question is incomplete --- the code only passes if you return the data frame sorted by BOTH department name AND rank. While in the problem description, it mentions to only rank by department name: "The results should be ordered by department name."
Not a big difference I know, but students shouldn't need to look into the solution to get the necessary knowledge to answer the question."See full answer