import pandas as pd

df = pd.DataFrame([
    [1, 1, 2, 2],
    [1, 1, 1, 1],
    [1, 1, 1, 1],
]).T
df.columns = [fr"col{i}" for i in df.columns]

print(
    df.pivot_table(
        index=["col0"],
        values=["col1", "col2"],
        aggfunc=sum,  # 同步! 默认mean
    )
)