Reputation: 87
I am trying to implement something on the following lines, however, I get an error
v=np.linspace(0,2,10)
v_2=v**2
v_3=v**3
np.column_stack(v,v_2,v_3)
The error I get is:
TypeError: _column_stack_dispatcher() takes 1 positional argument but 3 were given
I gogloode it but as I am an inexperienced programmer focused on mathematics, I did not understand the error, and its source. I would like someone to tell me what I should correct, in order for me to stack together different arrays generated by np.linspace.
Thanks in advance!
Upvotes: 0
Views: 130
Reputation: 1187
numpy.column_stack
takes only one argument, and it should be a tuple of arrays. That's why it is complaining of more than one arguments being passed. Pass your arrays in a tuple like this:
np.column_stack((v, v_2, v_3))
Upvotes: 1