Series Arithmetic
Operations work element by element and align on the index.
Example
a = pd.Series([1, 2, 3])
b = pd.Series([10, 20, 30])
print(a + b)
print(a * 2)
print((a + b).sum(), (a * b).mean())Result
0 11 1 22 2 33 dtype: int64 0 2 1 4 2 6 dtype: int64 66 46.666666666666664
Exercise
Add elementwise.
a b
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.