224k views
3 votes
Before doing the below parts, you can check that you are on the right track as follows. Use a boolean expression, followed by the sum function, to verify that 281 students got a higher mark on the test.

Select the correct boolean expression for this verification:
a) (df['Test Score'] > 281).sum()
b) (df['Test Score'] < 281).sum()
c) (df['Test Score'] == 281).sum()
d) (df['Test Score'] >= 281).sum()

User AMagic
by
7.8k points

1 Answer

6 votes

Final answer:

To verify that 281 students scored higher on a test, the correct boolean expression used with a DataFrame would be (df['Test Score'] > 281).sum(). Option a

Step-by-step explanation:

The correct boolean expression to use for verifying that 281 students got a higher mark on the test within a DataFrame df would be (df['Test Score'] > 281).sum(). This expression creates a boolean series where each row has True if the 'Test Score' is greater than 281, and False otherwise.

Using the sum() function counts the number of True values, which is equivalent to the number of students who scored higher than 281. Option a

User Mitchellt
by
8.6k points