A DataFrame built from a list repeated twice

Predict the output · Basic · §5.1 Checking the question and the data

The code puts the daily usage time of two apps into a long-format DataFrame and adds up the usage time for each app. Each row of the DataFrame is one app's usage time (in minutes) for one day.

Predict the output without running the code.

Code

import pandas as pd

usage = pd.DataFrame({
    "day": ["Mon", "Tue", "Wed"] * 2,
    "app": ["Video"] * 3 + ["Chat"] * 3,
    "minutes": [95, 80, 110, 40, 55, 35],
})
print(len(usage))
print(usage["day"].tolist())
totals = usage.groupby("app", as_index=False)["minutes"].sum()
print(totals["app"].tolist())
print(totals["minutes"].tolist())

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.