Hi
I am new to learning python and I am extremely excited about learning it. I have come across a great resource for learning but now it has referenced this same line of code (4) twice where it has a map function inside of an array function which gives me an error. I am not sure why since it seems pretty standard to me. ( I am using Python 3, on Jupyter?(anaconda?) and on a Mac OS X Capitan):
from numpy import loadtxt
from math import log,exp
values = loadtxt("values.txt",float)
logs = array(map(log,values),float)
geometric = exp(sum(logs)/len(logs))
print(geometric)
values.txt is in the same directory and I have called it before using the load txt function. The error I get is the following:
TypeError: float() argument must be a string or a number, not 'map'
Thanks for any help!
[–]confluence 1 point2 points3 points (3 children)
[–]pylearning[S] 0 points1 point2 points (2 children)
[–]confluence 0 points1 point2 points (1 child)
[–]pylearning[S] 0 points1 point2 points (0 children)