python function - calling using apply vs direct call : I have code as below. If I call the function by the first method, it works. But if I call the function using the second method, I get an error. I thought that method two should works as the function is expecting columns as it's input. Why do we have to say that run the function over columns as described in method 1?

    def impute_age(cols):
    Age = cols[0]
    Pclass = cols[1]
    
    if pd.isnull(Age):

        if Pclass == 1:
            return 37

        elif Pclass == 2:
            return 29

        else:
            return 24

    else:
        return Age


    #pd.isnull(train[['Age']])
    
    #method 1
    #train['Age'] = train[['Age','Pclass']].apply(impute_age,axis=1)
    
    #method 2
    impute_age(train[['Age','Pclass']])