The code obtains Box and Cox transformed data. The original data is a Pandas DataFrame and the process uses this DataFrame.
I am trying to speed up the following code. If you can elaborate in faster way of doing this it would be very helpful.
import numpy as np
import pandas as pd
from numpy.random import randn
from scipy import stats
np.random.seed(1)
df = pd.DataFrame(np.random.randint(1, 100,size=(100, 4)))
def st_bc(data):
data_bc = pd.DataFrame()
for column in list(data):
data_bc[column], lam = stats.boxcox(data[column])
return data_bc
st_bc(data = df)