I want to create a 2D array using lists. Each list should be a column in the matrix. How can I do that?

I tried numpy's hstack() and append(), but it did not work.

E.g.:

a = [1, 2, 3]

b = [4, 5, 6]

output:

[[1, 4],

[2, 5],

[3, 6]]

I tried numpy's hstack() and append(), but it did not work.

E.g.:

a = [1, 2, 3]

b = [4, 5, 6]

output:

[[1, 4],

[2, 5],

[3, 6]]