1

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?

1
  • What is p[3]? Could you please give a complete and working (but very short) example which displays this behavior. Commented Feb 18, 2013 at 20:23

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

3 Comments

I've trid but it gives me this error: NotImplementedError: Not implemented for this type what does it mean?
@user2044983: probably that your x isn't composed of numbers but of strings. What does print set(map(type, x)) return?
Please clarify what values has p.
0

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

logx = map(np.log, x)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.