0

I want to create a 3D-Graph. Therefore I want to put 3 calculated values, let's call them A,B and C, into an np.array. It should somehow look like this:

[A_1, B_1, C_1], [A_2, B_2, C_2], . . . [A_N, B_N, C_N]

How can I do this? I tried using in a for loop (the foor loop calculates the values of A,B,C)

E = np.array(A,B,C)

But this doesn't work.

2 Answers 2

1

Try it:

import numpy as np
A = [1,2,3]
B = [4,5,6]
C = [7,8,9]
array = np.array([A,B,C])
print(array)
array([[1, 2, 3],
       [4, 5, 6],
       [7, 8, 9]])
print(array.shape)
(3, 3)
Sign up to request clarification or add additional context in comments.

Comments

0

I'm not entirely sure what you are asking for but one thing you could take a look at is the following

https://repl.it/join/amkbnhhs-henride

here is the code

import numpy as np

a = np.array((1,2,3))
b = np.array((2,3,4))
c = np.array((2,3,4))
print(np.dstack((a,b,c)))

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.