Examples

In [ ]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame({'angles': [3, 4],
                   'degrees': [180, 360]},
                  index=['triangle', 'rhombus'])
df
Out[2]:
angles degrees
triangle 3 180
rhombus 4 360

Subtract a list and Series by axis with operator version:

In [7]:
df - [1, 2]
Out[7]:
angles degrees
triangle 2 178
rhombus 3 358
In [8]:
df.sub([1, 2], axis='columns')
Out[8]:
angles degrees
triangle 2 178
rhombus 3 358
In [9]:
df.sub(pd.Series([1, 1], index=['triangle', 'rhombus']),
       axis='index')
Out[9]:
angles degrees
triangle 2 179
rhombus 3 359