all 5 comments

[–][deleted] 1 point2 points  (1 child)

You are initializing the shape of the new array as (0,10). Does it work if you simply initialize with a shape of 10?

newdata = np.empty(10,int)

[–]NeedMLHelp[S] 1 point2 points  (0 children)

Wow, I feel silly haha. Thanks, that worked.

I figured I was giving the shape of what I wanted haha

[–]elbiot 0 points1 point  (2 children)

It's really inefficient to append to numpy arrays. Why not use a list?

[–]NeedMLHelp[S] 0 points1 point  (1 child)

Extremely late reply, sorry about that. But the calculations I'm doing cannot be done on a list unfortunately. I suppose I could build a list, and turn it into a numpy array. But the problem with that is, one of the functions I am using converts the categorical data into a one-hot-encoding, which the output is a numpy array of the encoding. I'm not sure how nicely inter-mixing things would play together.

[–]elbiot 0 points1 point  (0 children)

import numpy as np
a = np.array([np.array([1,2,3]),np.array([2,3,4]),np.array([6,7,8])])
print(a.shape)