Examples
import numpy as np
import pandas as pd
df = pd.DataFrame({'P': range(2, 5), 'Q': range(12, 0, -4)})
df
df.eval('P + Q')
Assignment is allowed though by default the original DataFrame is not modified:
df.eval('R = P + Q')
df
Use inplace=True to modify the original DataFrame:
df.eval('R = P + Q', inplace=True)
df