On 22/05/18 18:13, Glenn Schultz wrote: Cavbeat: I'm no dataframe expert so I'm going on general principles here...
> I am trying to apply the function to the data frame as follows: > > df['loanage'].apply(myfunction(x = 2, y = 10, z = 10, df['loanage]), axis = 0) This looks wrong on several counts: 1) apply() usually takes a function object as the first argument not the return value of a function call as here. 2) When calling a function using keyword arguments you re not allowe to have non-keyword arguments following the keyword ones, so the df[...] bit should be an error 3) The df['loanage] does not have a closing quote. > I get value error: The truth in the series is ambigous..... I'm not sure if any of the above would result in a ValueError but its possible. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor