Thanks! Sorry so is the following a correct understanding of when type declarations improve performance?
-
If a function takes a
column
of a DataFrame as an argument then type declarations do not improve performance. -
If a function takes an entire
DataFrame
as an argument then type declarations on each column will improve performance.
The docs on argument type declarations note that they generally do not enhance performance. But as you pointed out in a previous post about efficiency in iterating over columns of a DataFrame that:
and also that
My background is so minimal that I wasn’t sure whether type declarations here improved performance because the loop was entirely outside of a function or because the entire DataFrame was being passed as an argument into a function?
Assuming the latter, why does a function barrier work for a column of a DataFrame but not the entire DataFrame? Wouldn’t the type stability issue affect both the DataFrame
object and the DataFrame col
?