Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame({'angles': [5, 3, 0],
                   'degrees': [540, 180, 360]},
                  index=['pentagon', 'right triangle', 'circle'])
df
Out[2]:
angles degrees
pentagon 5 540
right triangle 3 180
circle 0 360

Add a scalar with operator version which return the same results:

In [3]:
df + 2
Out[3]:
angles degrees
pentagon 7 542
right triangle 5 182
circle 2 362
In [4]:
df.add(2)
Out[4]:
angles degrees
pentagon 7 542
right triangle 5 182
circle 2 362

Add by constant with reverse version.

In [5]:
df.radd(2)
Out[5]:
angles degrees
pentagon 7 542
right triangle 5 182
circle 2 362