PERF: Don't apply lambdas to large DataFrames.
PERF: Use numpy functions for concatenation in history.