difference between "function()" and "function"
In the second case you are directly calling the len method and will get the result, i.e. how many rows are in col1 in the df.
In the first you are giving the reference to the len function to the apply function.
This is a shortcut for df["col2"] = df["col1"].apply(lambda x: len(x))
This version you use if you want to make the behavior of a method flexible by letting the user of the method hand in the function to influence some part of an algorithm. Like here in the case with the apply method. Depending of the conents in the column you want to fill the new column with something, and here it was decided to fill this with the lengths of the content of other column.
I see

df["col2"] = df["col1"].apply(len)
len(df["col1"])

My question is,

Why use "len" function without parenthesis in 1, but use it with parenthesis in 2?

What is the difference between the two?


I see this kind of occasion a lot, where using a function with and without parenthesis.
Can someone explain to me what exactly is going on?
Thanks.