I have a pandas data frame as an attribute in Python 2.7, called probs. If I try to execute
log(self.prob['AAA'])
(where AAA is a valid name for one of the columns in the data frame), I get the error
exceptions.TypeError occurred
Message: only length-1 arrays can be converted to Python scalars
but in the interactive IPython, populating df with the same values and executing
log(df0['AAA'])
produces exactly what is needed (data frame column with each value being the log() of the original data).
What is the reason for the difference and is there a way to get the IPython behavior in the regular script?
probein the interpreter and from a file. I'm guessing the difference lies there.help(log), andhelp(adataframe['AAA'])orprint adataframe['AAA']in both cases and see if there is a difference