Using Python 2.
I need to split an array into their rows and columns but I don't seem to get the solution as asked in the exercise
import numpy as np
a = np.array([[5, 0, 3, 3],
[7, 9, 3, 5],
[2, 4, 7, 6],
[8, 8, 1, 6]])
So far I have these functions
def _rows(a):
print("array:"+ str(a[:,]))
_rows(a)
def _col(a):
alt=a.T
print ("array:"+ str(alt[:,]))
_col(a)
but I need to return a list and when I use the list() function it separe each individual character
I need the result to be:
[array([5, 0, 3, 3]), array([7, 9, 3, 5]), array([2, 4, 7, 6]), array([8, 8, 1, 6])]
[array([5, 7, 2, 8]), array([0, 9, 4, 8]), array([3, 3, 7, 1]), array([3, 5, 6, 6])]