I have a code that generates me within a for
loop two numpy arrays (data_transform
). In the first loop generates a numpy array of (40, 2)
and in the second loop one of (175, 2)
. I want to concatenate these two arrays into one, to give me an array of (215, 2)
. I tried with np.concatenate
and with np.append
, but it gives me an error since the arrays must be the same size. Here is an example of how I am doing the code:
result_arr = np.array([])
for label in labels_set:
data = [index for index, value in enumerate(labels_list) if value == label]
for i in data:
sub_corpus.append(corpus[i])
data_sub_tfidf = vec.fit_transform(sub_corpus)
data_transform = pca.fit_transform(data_sub_tfidf)
#Append array
sub_corpus = []
I have also used np.row_stack
but nothing else gives me a value of (175, 2)
which is the second array I want to concatenate.