user2044983
user2044983

Reputation: 47

Function of an array

I have an array defined in this way (extracting the third column of a dataset):

value=[]
value.append((p[3]))
x=np.array(value)

How can I do if I would like to obtain a new array containing the Log10 (o a different function) of the array x? I have tried with:

logx=np.array(log(x))

but it gives me the following error:

TypeError: 'numpy.ufunc' object is not subscriptable.

Where am I wrong?

Upvotes: 1

Views: 1536

Answers (2)

Cameron Sparr
Cameron Sparr

Reputation: 3981

Not sure why Nikolay's answer isn't working for you, but you could also do:

logx = map(np.log, x)

Upvotes: 0

Nikolay Polivanov
Nikolay Polivanov

Reputation: 677

You can just use: logx = np.log(x)

Upvotes: 6

Related Questions