apply method in pandas.DataFrame has signature like this:
DataFrame.apply(func, axis=0, broadcast=False, raw=False, reduce=None, args=(), **kwds)
If I have a function with parameter, how can I pass this function to apply?
For example, the function is:
def foo(x, activation = 3.0):
    ...
    return calculated_val
When I set args = 5, there is an error says, *args must be an iterable.
            Asked
            
        
        
            Active
            
        
            Viewed 38 times
        
    0
            
            
         
    
    
        Aperion
        
- 273
- 3
- 7
- 
                    1Use `df.apply(foo, args=(5,))` ? – Jon Clements Apr 15 '18 at 07:24
- 
                    See this answer from the dup target https://stackoverflow.com/a/43460506/2336654 – piRSquared Apr 15 '18 at 07:27