How transpose my matrix in python
A = [1, 2, 3, 4]
into:
B = [[1],
[2],
[3],
[4]]??
A is numpy.array. When I transpose it by using A = A.T i get:
B = [[1,
2,
3,
4]]
Thanks for help!
It must be exactly like:
B = [[1],
[2],
[3],
[4]]
Not:
B = [[[1],
[2],
[3],
[4]]]
Not:
B = [[1]\n\n,[2]\n\n,[3]\n\n,[4]\n\n]
Look into debugger, not what is printed. U know what I mean?
Aas displayed is a list, not numpy array. But if made into a list, its shape will be (4,) (1d). What you want has a shape of (4,1). You can either reshape that directly, or you can make a (1,4) shape array, and transpose that. This is not MATLAB where everything is 2d to start with.