Run ❯
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
import pandas as pd def calc_sum(x): return x.sum() data = { "x": [50, 40, 30], "y": [300, 1112, 42] } df = pd.DataFrame(data) x = df.apply(calc_sum) print(x)
x 120 y 1454 dtype: int64