ExamGecko
Question list
Search
Search

Question 28 - DSA-C02 discussion

Report
Export

Consider a data frame df with 10 rows and index [ 'r1', 'r2', 'r3', 'row4', 'row5', 'row6', 'r7', 'r8', 'r9', 'row10']. What does the aggregate method shown in below code do?

g = df.groupby(df.index.str.len())

g.aggregate({'A':len, 'B':np.sum})

A.
Computes Sum of column A values
Answers
A.
Computes Sum of column A values
B.
Computes length of column A
Answers
B.
Computes length of column A
C.
Computes length of column A and Sum of Column B values of each group
Answers
C.
Computes length of column A and Sum of Column B values of each group
D.
Computes length of column A and Sum of Column B values
Answers
D.
Computes length of column A and Sum of Column B values
Suggested answer: C

Explanation:

Computes length of column A and Sum of Column B values of each group

asked 23/09/2024
Victor Chacon
34 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first