Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame({'angles': [0, 3, 4],
                   'degrees': [360, 180, 360]},
                  index=['ellipse', 'right triangle', 'rectangle'])
df
Out[2]:
angles degrees
ellipse 0 360
right triangle 3 180
rectangle 4 360
In [3]:
df.sub([1, 2], axis='columns')
Out[3]:
angles degrees
ellipse -1 358
right triangle 2 178
rectangle 3 358
In [4]:
df.rsub([1, 2], axis='columns')
Out[4]:
angles degrees
ellipse 1 -358
right triangle -2 -178
rectangle -3 -358