Reputation: 1537
I want to convert each row from a pandas dataframe into an array, and then create a matrix with them.
I know how to do it with columns:
X = np.matrix([df['colA'].values,
df['ColB'].values])
How can I do it by columns?
More details:
this is a sample of my dataframe:
The output I want is this (please do not pay attention to the digits now):
[[36.10062, -115.2948], #row 0
[36.10062, -116.2948], #row 1
[34.10062, -112.2948], #row 2
[38.10062, -111.2948]] #row 3
Upvotes: 0
Views: 1772