What idxmax returns on a filtered DataFrame

Predict the output · Medium · §6.4 Annotations and reference lines

From a DataFrame of response times by hour for two servers, the code selects only server B's rows and finds the slowest hour. Predict the three lines of output without running the code.

Code

import pandas as pd

resp = pd.DataFrame({
    "server": ["A"] * 4 + ["B"] * 4,
    "hour": [9, 12, 15, 18] * 2,
    "ms": [120, 180, 150, 140, 90, 110, 210, 160],
})
b = resp[resp["server"] == "B"]
top = b["ms"].idxmax()
print(len(b))
print(top)
print(b.loc[top, "hour"])

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.