According to the following code pandas.DataFrame.apply, the first column is called twice. I wonder why this is happening and if there is a way to avoid it as the function might be an expensive function.
import pandas as pd
def func(x):
print(x)
return x*2
df = pd.DataFrame([[1,3,2], [5,1,4],[3,9,1]])
df2 = df.apply(func)