I have a 2d numpy array called my_data
. Each row represents information about one data point and each column represents different attributes of that data point.
I have a function called processRow. It takes in a row, and does some processing on the info and returns the modified row. The length of the row returned by the function is longer than the row taken in by the function (the function basically expands some categorical data into one-hot vectors)
How can I have a numpy array where every row has been processed by this function?
I tried
answer = np.array([])
for row in my_data:
answer = np.append(answer,processRow(row))
but at the end, the answer is just a single really long row rather than a 2d grid